How can I rescue my passwd file after corrupting it (and why does it still work) ?

George Sanders gosand1982 at yahoo.com
Sun Nov 22 04:27:28 UTC 2009



I do some automated account creation on a FreeBSD 6.x system ... and unbeknownst to me, the '/' filesystem was completely full when I did my last account creation, resulting in:

/: write failed, filesystem is full
pwd_mkdb: /etc/pwd.db to /etc/pwd.db.tmp: No space left on device
pw: passwd file update: No space left on device
pwd_mkdb: corrupted entry
pwd_mkdb: at line #187
pwd_mkdb: /mnt/etc/master.passwd: Inappropriate file type or format

My situation is now as follows:

passwd and master.passwd have a lot of lines missing, and one or two mangled lines toward the end.  So a LOT of user accounts are gone.

BUT, all of those missing accounts still work.

So ... 

1) why do all of the accounts that are missing from both passwd and master.passwd continue to work properly (they can authenticate and log in over SSH and so on) ?

2) how can I get back to healthy ?

I suspect that somehow my (s)pwd.db files are still healthy ... is it possible to reconstruct complete passwd/master.passwd files using the existing (s)pwd.db files ?

Thank you.


      



More information about the freebsd-questions mailing list