Howto reset the forgotten root password (Access single user mode) in Debian/Ubuntu

undefined

How many times did you need to reset the root password for Debian/Ubuntu Linux? or How many times did you need to login to Debian/Ubuntu in a single user mode to perform some fixes for you Linux box?.

For me, I had to login many times, and I expect you’ll need to login in a single user mode many times also.

 

In this mini post I’ll show you how to login in a single user mode to do whatever you need. To do this, do the following steps:

 

  1. Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
  2. As soon as the boot process starts, press ESC to bring up the GRUB boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB boot prompt.undefined
  3. You will see a GRUB boot prompt – press “e” to edit the first boot option. (If you do not see the GRUB prompt, you may need to press any key to bring it up before the machine boots)
  4. By using the arrow keys, find the kernel line (starts with “linux /boot/“) and add init=”/bin/bash” at the end of the line, see the following image:undefined
  5. Press CTRL-X or F10 to boot.
  6. System will boot and you will see the root prompt.
  7. You must remount the root file system with option “rw” before changing it’s password otherwise the password will not be changed, by default the root file system is mounted in “ro“, the below image shows what I mean:undefined
  8. Type “mount -rw -o remount /” and then “passwd” to change the root password as follow:undefined
  9. Finally, reboot your Debian/Ubuntu server.

If You Appreciate What We Do Here On Mimastech, You Should Consider:

  1. Stay Connected to: Facebook | Twitter | Google+
  2. Support us via PayPal Donation
  3. Subscribe to our email newsletters.
  4. Tell other sysadmins / friends about Us - Share and Like our posts and services

We are thankful for your never ending support.

Leave a Reply

Your email address will not be published. Required fields are marked *