How to change root password via rescue system (Linux)?

0 Shares
0
0
0
0

How to change root password via rescue system (Linux)?

If you have forgotten or lost your root password and want to reset it via Rescue System, please follow these instructions:

1.) Start your server in Rescue Mode and go to the dedicated server administration. There you activate the “Start rescue mode” function. After the rescue system has been successfully started, the master password for rescue mode will be displayed at this point in the Central Customer Management (ZKM).

2.) Use this password to establish an SSH connection with the Rescue System (on Windows you can use the “Putty” client).

3.) Once connected via SSH, enter one of the following commands to find your root partition (the largest partition is usually the desired root partition):

fdisk -l # or parted -l

Once you have identified the system partition, mount it:

Without software RAID (/dev/sda1 may be different):

mount /dev/sda1 /mnt

With software RAID (/dev/md0 may be different):

mount /dev/md0 /mnt

4) Now that you have your disk mounted, mount “procfs” and “devfs”:

mount -o bind /dev /mnt/dev mount -t proc /proc /mnt/proc

5.) Use the “chroot” command to log into your system and change your password:

chroot /mnt /bin/bash

6.) You should now be logged in. You can now change the password with passwd:

password

Note: You will now be asked twice to enter the new password, whereas entering a Linux password usually displays nothing.

7.) Now that the password has been successfully changed, remove the mounted disks and log out of your system with the following command:

exit

Return to the root directory with:

cd /

Now delete the existing directories one by one again:

umount /mnt/proc umount /mnt/dev umount /mnt

8.) Now reset the rescue mode in the Central Customer Management (ZKM) and restart the system by rebooting.

9.) You can now use the newly set password to log in via SSH.

[Total: 1   Average: 5/5]
Leave a Reply

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

You May Also Like