Modification of the root password


The example below explains how to change your password using the rescue system.
The problem is, if you type “passwd” you will only change the password of the rescue system and after a reboot your modifications will be reset.
It is required to find a way to access your real files to change the password.
This will be explained in this tutorial.

Start with mounting your partitions.

Then you will have to chroot yourself into the root partition:

sudo chroot /mnt/sda2
The root partition will be mounted on sda2 if you have installed your server with the default partition layout during the installation of your OS
If you did a custom partitioning your root partition may be mounted elsewhere.

Now use the following command to reset the password:


You will be asked two times.
While you are writing, nothing will appear on the screen. This is normal and a security measure.

If you want to reset the password of a different user than root, you will have to use the following command:


You have to replace “USERNAME” with the name of the user concerned.

When you have finished your modifications type



sudo && sudo reboot

Finally click on “Boot in normal mode” in your account to reboot the server.

Your root password is now the one you have defined previously.