Friday, April 17, 2009

Can I speak with root?

Once again... this is not a very exciting post. Unless you are having to re-install a Linux system because you do not have the root password, then it could be like sex. Maybe just a piece of candy but you get the idea.

First get the installation media for said system. In this example it is a Red Hat 4.6 or 5.1 system. Then perform the following:
1. Boot from the media. When it comes up with the installation prompt type "linux rescue"
2. The system will continue to boot and ask about the network interface - it is not needed
3. When it asks about mounting the installation allow it to mount with read-write

Now for the fun part.. ok as fun as it gets

4. The hard drive installation will be under /mnt/sysimage
5. Change to /mnt/sysimage/etc and then edit shadow with vi
6. Find the root entry in the shadow file it will look like:


7. Change the line in the file to look like the following:


8. Save and exit vi, and then reboot the system
9. Voila, no root password.
10. Log in as root and set the password with the passwd command ASAP!

No comments: