Reset the root password in rescue mode

he 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:

passwd

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:

passwd USERNAME

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

When you have finished your modifications type

exit

then

sudo umountall.sh && 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.

  • 0 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

How to setup the RDNS?

1.Login to clientare, Click need setup RDNS server 2.Select need setup RDNS IP Address, Click...

Mounting the partitions

A script is available in rescue mode for mounting the partitions of the disks. It only requires...

Correct a problem with the firewall configuration

At first you have to mount your partitions. The editors “vi” and “nano” are available in the...

Mounting the partitions

A script is available in rescue mode for mounting the partitions of the disks. It only requires...