Deleted /etc/passwd

Hi all,
While playing with my LINUX machine i accidently deleted a file name called /etc/passwd . Even though the system is booted am unable to get the login prompt. Is there any remedy for this problem.:frowning:

yeah, boot from a boot cdrom and go into recovery mode (assuming that you use your distro's cdrom for this). Then, mount your old drive:
mkdir /olddrive
mount /dev/hda5 /olddrive
assuming that your old drive is on /dev/hda5.
then, cd to /olddrive/etc
type:
echo "root::0:0:Superuser:/:/bin/bash" > passwd
then reboot. That will set no passwd for root. Then, you can login, create all of your accounts over again, etc. BTW, some distros might have made a backup for you called passwd.old or something similar, check it out :wink:

You can use Floopy Boot Disk (FBD) to Boot on Linux. After restore /etc/passwd from FBD or from file backup /etc/passwd.bak

Good Luck

Thanks for both of u. After my extenuating work with my system atlast i got my login prompt back.
take care

hi cyno..., with reference to above who should be taking care...(of ur etc/passwd file)
binhnx2000 or cerberusofhate.... ..hhmmmm
just joking ,
bye..

1 Like

most linux distro's make copies of passwd
and call them passwd- or passwd.bak
most bsd's make a backup of the complete /etc dir
try some stuff like ls passwd* in /etc
let me know, and good luck :slight_smile: