12

Looking at the files in /etc/:

/etc/group:lbutler:*:1005:
/etc/master.passwd:lbutler:$6$s..../:1005:1005::0:0:L Butler:/home/lbutler:/bin/bash
/etc/passwd:lbutler:*:1005:1005:L Butler:/home/lbutler:/bin/bash

But:

$ passwd lbutler
passwd: lbutler: no such user

Also, files in /home/lbutler/ show up as uid 1005 and gid lbutler

The other users in /etc/passwd do not appear to have a problem

4 Answers 4

9

It seems that some corrupts haved occured with your /etc/master.passwd. You can restore it to normal state, try:

  • vipw to edit /etc/master.passwd.
  • Save it with no changes.

You can also use pwd_mkdb to update password database.

4
  • 6
    +1: The OP may be a Linux user, and is thinking that the OS actually pays attention to /etc/passwd as a primary source. On FreeBSD, the DB files generated from /etc/passwd and such are the actual primary source of truth. Apr 6, 2014 at 17:46
  • OP please use vipw in the future then you don't have to manage the details.
    – Winny
    Apr 6, 2014 at 20:55
  • Using vipw and save unchanged did not make a difference. I did look at the backups and the user password for the user listed before this one in the master.passwd file changed right about the time butler stopped being able to login. I can restore the master.passwd should I run pwd_mkdb /etc/master.passwd? @winny: I've never directly edited a passwd file
    – lbutlr
    Apr 6, 2014 at 21:11
  • This should be the right invocation arguments: pwd_mkdb -p /etc/master.shadow
    – Winny
    Apr 6, 2014 at 23:10
3

Try pwd_mkdb -p /etc/master.passwd. From man pwd_mkdb:

 -p    Create a Version 7 style password file and install it into
       /etc/passwd.
1

I noticed that the user immediately before lbutler had a UID and GID of 10014 (instead of the expected 1014). That user changed her password and after that, UID 1015 could not login. Using vipw I reversed the two lines and saved the file. Both users can now login and ownerships appear correctly. Thanks for the pointers.

0

FreeBSD does use the database files for looking up the passwords and users and so on. So the /etc/passwd and also the master.passwd is there only for compatibility and informational reasons. One should never rely on that. I do not know if there is a way to ask that database files directly. Maybe they should provide some kind of SQL interface to it so that ppl can check out what users are on the system and so on. Then they could abolish /etc/passwd and master.passwd completely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.