Computer security is a basic feature that is often over look by usual users. Operating systems whether Linux, Microsoft Windows, or Apple OS have made security an important feature. But, it is a common mistake people have to leave a desktop computer without any password.
While this is not true for computer servers as system administrators keen on computer security. What do we need to do when we lost or forget root password of the computer server. Can the root password of a Redhat Enterprise Linux box be reset? I encountered this situation when the Redhat Enterprise Linux server which hosts our database was handed over from an administrator that left the job.
Actually, removing the root password would be relatively easy, if you have physical access to the Linux server. It only requires direct access to the “shadow” file. To access the file, I used an Ubuntu Live CD to boot and mount the fixed disk. Luckily, after loading the Ubuntu, I went to the “media” folder and found that the fixed disk was mounted automatically. The partition or folder I was interested was the one containing the “etc” folder which host the “shadow” file. This was located under “/media/disk/”.
I navigated to “/media/disk/etc/” and using the a text editor edited the “shadow” file. You can find the line which starts with “root” as shown:
The cryptic mix of alpha numeric and special characters is actually the password. Thus, by deleting that value “$B7mx0LiRQrf7micb1$acb.nztB.8H68Bx0L” between the semi-colon, the root password will be removed. The line will look like the following after editing:
You can save the “shadow” file and restart the Redhat Enterprise Linux and remove the Ubuntu Live CD. You can now login to the Linux box with user root without any password.