edit this article

Recovering the root password

This tip shows you a couple of ways to reset the root password if you've forgotten it.

The easiest way is of course to boot off a LiveCD, chroot into the primary hard disk as described in the Gentoo Install Guide and use passwd.

If you don't have a LiveCD, or the system doesn't have CDROM drive, you can reboot the system into single user mode to reset the password. Simply pass the options "init=/bin/sh" to the kernel from the bootloader menu. When the system boots it will drop you into a root shell. The disk will be mounted read-only so remount it read-write with

mount -o rw,remount /dev/ROOT
(be sure to change ROOT to your actual root partition). Edit /etc/shadow and remove the encrypted password. Reset the root password with passwd and reboot the system.

You should now be able to login with the new password.

From http://www.gentoo.org/news/en/gwn/20040301-newsletter.xml

rate this article:
current rating: average rating: 1.0 (24 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)