How to reset root password on Linux server

First we need to boot into recovery mode. To do so, restart server and hold Shift down to call up the boot menu. Then select (recovery mode) for the image you are using. Once you get Recovery menu, select root and press Enter. You will be redirected to recovery console.

 root@server1:~#

At this point we need to mount file system, since it is in RO (read-only) mode. To do so, type the following:

mount -rw -o remount /

Now you can change root password (or any other user you use to administer your server with) using the following command:

passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

If you forget to mount file system as read and write you will be presented with the following error once you try to change user password:

passwd: Authentication token manipulation error
passwd: password unchanged

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.