Root Password

From PCLinuxOSHelp Knowledge Base
Jump to: navigation, search

Reset root password in Linux

There are a number of different ways to do root password recovery on a Linux system. Different distributions make it easier than others. You must be physically in front of the system.

Boot from your first install CD and as the very first screen comes up hit F2 and type: rescue and the computer will boot in rescue mode.

Select “mount the existing partitions” and go to the shell/console prompt.

Boot from the first install CD ( or any Live CD like Knoppix ) and at the boot prompt type: linux single It will boot in “single user mode” and you will get an odd looking prompt like “sh-2.09#” Alternative, With the most Live and Rescue CDs you can also just boot in the live version, mount the partition and, as root, make changes to the files indicated below:

  1. cd /etc

To reset password, as root user, we need to change two files; “passwd” and “shadow”

  1. nano passwd

find root:x:0:0:root:/root:/bin/bash


Change it to: root::0:0:root:/root:/bin/bash


Save and exit the file.

Now open the shadow file

  1. nano shadow

The first line is a long line of characters


Change it to: root:::: ( four colons : )


Now you can reboot your computer. Log in as normal user, open a console and as the root user type: $ su

  1. passwd

New password: Retype new password:


Now, you can log in as a root user with the new password.