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
Explain getopts command of linux?
Is cmake a compiler?
How do I move to root in linux?
What are the basic commands for user management?
How do I check disk space in linux?
Enlist some linux networking and troubleshooting commands?
What file type is a makefile?
What is vnc?
Which command is used to delete a group?
What is difference between egrep and grep?
What command used for showing user info like Login Name, Canonical Name, Home Directory,Shell etc in Linux?
What is pwd in linux command?
How do I list directories in linux?
What does sh do in linux?
How many commands are there in linux?