0

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?

5
  • 1
    Passwords are usually stored in /etc/shadow, what exactly is the error message you see?
    – Jan
    Oct 7, 2014 at 21:21
  • 1
    Do you have a recovery CD?
    – ryekayo
    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
    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
    Oct 8, 2014 at 22:11
  • I have a Linux ES Bootable CD, will that work for a rescue CD? Novice. :)
    – Adam
    Oct 10, 2014 at 17:53

1 Answer 1

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

2
  • I am on a Red Hat Ent. Linux ES release 4 (Nahant Update 8)
    – Adam
    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
    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 .