Change lost root password

From SecurityForest


If you have a boot loader password this isn't going to work. That requires a little bit more work. However, if you have simply lost the root password and want to change it to something you know then this is all you need to do. This simply explains how to boot into single user mode when you are sitting in front of the machine and change the root password.

LILO

At the boot screen hit CTRL-x and type "linux single" and hit enter.
It should boot to a shell and then you can simply run passwd and change the password.

GRUB


At the boot screen hit "e", select the line with "kernel" on it, hit "e" again, and add "single" to the end of the line. Press enter and then boot to boot to a shell. From there you can run passwd and change the root password.

Drive Not Mounted


If your root partition is not mounted when you get to the shell you can run

mount -o remount,rw /

to mount it. You can verify it's mounted with the commands df or mount.

Advertisement