In my linux machine, i lost /etc/passwd file
and /etc/shadow file, then how can i recover it?

Answer Posted / sachinmali17

## In that case you need to recover /etc/passwd file first.
For this you have to following steps,

-Start GRUB on boot (press ESC while booting)
-Press e over (recovery mode)
-Press e over the line beginning with kernel
-Press Space bar and enter "init=/bin/bash"
-Press enter
-Press b
-At command prompt type: "cp /etc/passwd- /etc/passwd"
-reboot to GRUB again
-Press e over (recovery mode)
-Press e over the line beginning with kernel
-Press Space bar and enter "init=/bin/bash"
-Press enter
-Press b
-At command prompt type "mount -o remount,rw /"
-Type "passwd YOURUSERNAMEHERE" (IF you don't know your user
name type "ls /home" (that is a Lower case L and lower case
S) for a list of users)
-Enter new password at prompt
-reboot to normal boot.

Hope that helps others like it did me!

### Then to recover /etc/shadow file, Use following command
pwconf

This command will generate /etc/shadow file from /etc/passwd


Is This Answer Correct ?    17 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are runlevels in linux?

524


What is ll command in unix?

622


What is the purpose output of cd command?

578


How do I change directories in linux command line?

477


Explain trap command of linux?

575






How do you grep?

562


How find ip address linux?

555


How use more command in linux?

542


Explain about the command elm?

578


How will you suspend a running process and put it in the background?

1022


How do you execute more than one command or program from a single command line entry?

558


What is DISM command?

514


What is the makefile in c?

548


what do know about commands?

584


What command would you use to check how much memory is being used by linux?

556