How to recover a forgotten root password

Valic —  June 2, 2010 — 2 Comments

First, don’t panic! This is usually a simple matter so long as you have physical access to the console.

Simply follow the steps below to boot the system bypassing login, and then set a new password:

Step 1. Reboot the system. Make sure your physically present.

Step 2. When the Grub menu comes up, press “e” to edit the menu selections.

Step 3. Select the kernel you would usually boot and press “e” to edit the settings.

Add single init=/bin/bash” to the end of the existing line. This will set the system to boot in to single user mode and immediately load a bash shell.
Stept 4. Finally, press “b” to boot.

The system will boot up into single-user mode with the root file system mounted read-only. To set a new password you will first need to re-mount it read/write:
mount -o remount,rw /
Now you can proceed to set a new root password:

passwd

Valic

Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

2 responses to How to recover a forgotten root password

  1. Hi,

    you missed a / which is very important! the last command before passwd should read actually:

    mount -o remount,rw /

    without it mount command has nothing to mount (to or from, I’m not sure, but anyway this way works well)

    Regards,
    Raimon

  2. Thanks.

Leave a Reply