How to reset root password on the Linux server

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

 root@server1:~#

At this point, we need to mount the 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 the 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\npasswd: password unchanged
Leave a Reply 0

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