How to Reset the Root Password on GNU/Linux

In this tutorial, we’ll look at how to reset the root password on GNU/Linux.

Every now and then, you might need to reset the root password on a GNU/Linux server. You might have forgotten it, or you might have taken over from a systems administrator who is no longer with the company.

In this situation, it’s important to have a process that’s as simple as possible and compatible with different GNU/Linux distributions.

NOTE: It’s important to bear in mind that it isn’t possible to retrieve an old password. You can only set a new one if you forget your current one.

 

How to Reset the Root Password on GNU/Linux

 

Before you begin:

To successfully complete this tutorial and recover the root password on GNU/Linux, you will need:

 

Resetting the Root Password on GNU/Linux

First, you need to restart the server and press the E key on the boot screen. This will load the GRUB bootloader.

Next, press Ctrl+E to edit the boot commands, search for the line that begins with “Linux”, and add “init=/bin/bash/” to the end of the line. This will allow you to boot the Shell (the command prompt used by GNU/Linux) the next time the system boots.

NOTE: You might encounter a problem when trying to type “=”. If this happens, you can type the character using its ASCII code, ALT+61. 

Once you have done this, press F11 to reboot the system.

Changing the settings in the GNU/Linux boot menu

Changing the  settings in the GNU/Linux boot menu

When the system boots up again, run the following commands to mount the disk with read/write permissions:

mount -o remount,rw /

passwd

Once you run the command “passwd”, you will be asked to enter your new root password and then confirm it.

Lastly, run the following command to mount the disk with read permissions:

mount -o remount,ro /

Once all this is done, restart the machine and, as long as everything has been done correctly, you should be able to access the system using your new password.

 

Conclusion

This tutorial explains the simple steps to follow to reset the root password on your GNU/Linux server.

We hope that you have found this tutorial useful, but if you do encounter any problems, please don’t hesitate to contact us so that we can help you.

Thanks for choosing Jotelulu!

Categories:Servers

Fill out the form and one of our Sales team will contact you soon.

growth@jotelulu.com  |  jotelulu.com 

You can unsubscribe from these communications at any time. For more information,  check our Privacy Policy.