Change Lost Root Linux Password

August 23, 2004

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 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.

Related Posts

2 Comments

Comment July 22, 2009 by Boopathy
I got it thanks
Comment March 15, 2011 by anonymous
Will this work in Fedora??? If not how to change root password in fedora linux?