Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running FreeBSD 9.1-PRERELEASE on a vps running on XEN virtualization, I tried to update it to 9.1-RELEASE but mergemaster toasted my /etc/master.passwd and /etc/passwd so what i have now is a blank copies of the two files.

What i did is use a mounted Live CD and mount my root partition to /mnt and manually re listed every entry to /mnt/etc/master.passwd and /mnt/etc/passwd from another freebsd server. I believe that everytime you edit master.passwd and passwd you have to run pwd_mkdb but this gives me "Read Only File" error.

What I plan to do is enable PermitRootLogin and PermitEmptyPassword first so I can login as root first before I redo necessary changes again. But i have to run pwd_mkdb, so is there a way to run this command from Live CD?

share|improve this question
    
did you check /mnt was not mounted read only? –  coincoin Dec 13 '12 at 10:28
    
I haven't, how do i do that anyway? I just know too little on freebsd, i can only manage it to run a webserver. Someone from another forum mention to chroot the mounted partition? –  jmc Dec 13 '12 at 10:31
    
Have you tried booting the system into single user mode? Escape to the loader on boot and run 'boot -s'. If it asks for the path to SHELL, just press enter to use the default. Hopefully you should get to a command prompt. If / is mounted read-only, just run 'mount -uw /' to change the mode. You should then be able to sort out /etc/master.passwd and run 'pwd_mkdb -p /etc/master.passwd' (You may have to run 'mount -a' to mount /usr so you have the pwd_mkdb command) –  USD Matt Dec 13 '12 at 11:12
    
@ USD Matt: I tried that already but it hangs after i type "boot /boot/kernel.old" i think it's because i updated my OS thru "svn" and i started to do a make build world but that ssh session disconnects.. –  jmc Dec 13 '12 at 11:29

1 Answer 1

Okay i think i got it now, after i mount /dev/ada0p2 to /mnt i did a chroot /mnt and then i run /usr/sbin/pwd_mkdb -p /etc/master.passwd then restarted the server and there, i can login again using the user i manually inputted

share|improve this answer
    
Note: passwd and master.passwd are not used for login. pwd.db and spwd.db are used. So if they're still good, you should be able to login at least. Also, if these are overwritten by the upgrade process (mergemaster et al) a backup copy is kept in /var/backup until you reboot. –  Chris S Dec 13 '12 at 14:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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