Ubuntu – How to recover a deleted /etc/passwd file?


I deleted the /etc/passwd file and cannot login now. I don't know the root password and tried lots of passwords, but none of them worked.

How can I fix this?

Best Answer

This question seems to already have the suitable answers, I will just expand on @Lekensteyn 's comment:

sudo cp /var/backups/passwd.bak /etc/passwd
sudo chmod 644 /etc/passwd
Related Question