I am running Red Hat Enterprise Linux ES release 4 (Nahant Update 8). The /etc/passwd file was overwritten by mistake. I have a backup copy of the original passwd file, but when I try to log in as root, or admin, I am denied access. How can I log back into the server and replace the passwd file with the original?

  • 1
    Passwords are usually stored in /etc/shadow, what exactly is the error message you see?
    – Jan
    Commented Oct 7, 2014 at 21:21
  • 1
    Do you have a recovery CD?
    – ryekayo
    Commented Oct 7, 2014 at 21:21
  • I would boot from a Linux on CD/USB and create a new /etc/passwd, or restore it from backup. If booting like that is not possible, remove the system HD and mount it on a different machine (e.g. via an USB enclosure) and restore /etc/passwd
    – Anthon
    Commented Oct 8, 2014 at 22:00
  • Can you access GRUB and modify the kernel boot arguments? Passing init=/bis/sh would launch sh instead of the default init on the readonly mounted root filesystem. You then can remount the root FS to be writable and restore a backup of the passwd file. If that sounds like black magic to you, better look for a rescue CD...
    – user62916
    Commented Oct 8, 2014 at 22:11
  • I have a Linux ES Bootable CD, will that work for a rescue CD? Novice. :)
    – Adam
    Commented Oct 10, 2014 at 17:53

1 Answer 1


I think you need rescue mode of your linux dist

you didn't say what dist you're on but here's an example for Fedora/RH/CentOS: http://fedoraproject.org/wiki/How_to_reset_a_root_password

  • I am on a Red Hat Ent. Linux ES release 4 (Nahant Update 8)
    – Adam
    Commented Oct 8, 2014 at 17:46
  • the link I gave above should work for RH but I found some RH-specific links too: link link good luck!
    – j-marr
    Commented Oct 9, 2014 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .