Fixing Root Password Problems
Q. I forgot the root password! The root password expired! What do I do?
Contributed By Kurt Wall and
Bill Campbell reviewed it,
found notable shortcomings and fixed them, making substantive
in the process.
If you've simply forgotten THE password
"Martin Meyer" <firstname.lastname@example.org>
restart the system and at the lilo prompt type [
[imagename] simply refers to the kernel prompt eg
This starts linux in runlevel 1 instead of the standart runlevel 3 or
5, requiring no password and opening a shell as root on a single virtual
console. You can then issue the passwd command as you normally would,
then type 'init 3' or 'init 5' to continue to
your normal runlevel.
- The first step is booting the system using a method that bypasses
password prompts. How to do this depends on the boot loader. If you
use LILO or GRUB, we've got you covered. If you don't use
or GRUB, you're on your own, but the information in this step
- If your system uses the LILO boot loader, do the
following. After the box completes its POST routine, you should see the
boot: prompt. At the prompt, type linux init=/bin/sh
and press Enter.
boot: linux init=/bin/sh
- If your system uses the GRUB boot loader it works
- Using the arrow keys, select the kernel you want to
- Type e, which will allow you to edit
- Use the arrow keys to move the cursor to the line that
kernel = , then press e
again to edit the line.
- Type Ctrl+e or use the arrow keys to move the cursor
end of the line.
- Add a space, followed by init=/bin/sh, then press
- Type b to boot.
- Eventually, you will be presented with a shell prompt like so:
At that prompt, remount the root file system in read/write mode
you wish, clear the screen of graphical detritus using the
bash# mount -n -oremount,rw /
- Now, change the password. As usual, you will need to type the password
bash# /usr/bin/passwd root
- Sync the hard drive by typing sync; sync; sync
- Remount the hard drive read-only:
bash# mount -n -o remount,ro /
- Reboot the machine.
At this point I recommend logging as root using the password you
changed, and run the passwd command again to insure that all
the authentication files are updated correctly.