Showing posts with label deleted /etc/passwd accidently. Show all posts
Showing posts with label deleted /etc/passwd accidently. Show all posts

Saturday, April 13, 2013

Recover /etc/passwd file in Linux


/etc/passwd is deleted accidently, Recover the file.

There is a backup file of /etc/passwd in same directory with name passwd-
$ sudo cp /etc/passwd- /etc/passwd $ sudo chmod 644 /etc/passwd

Lock the file using
$ sudo pwck -q

If you are not root user and do not use sudo before pwck -q, it will give error
pwck: cannot lock /etc/passwd; try again later.