How to Restore Your Linux Server Password in OVH or Hetzner

0
224
How to Restore Your Linux Server Password in OVH or Hetzner

How to Restore Your Linux Server Password in OVH or Hetzner

How to Restore Your Linux Server Password in OVH or HetznerWhen you loss your linux server root password and You can not log on to your server and your server in datacenter ovh or hetzner.

I will guide how to restore root password.

Here step by step how to restore your root password.

Step 1 :

Log into your datacenter control panel and boot your server in rescue mode

Step 2: Identify the mount point

The mount is created automatically on any server, so you just need to identify where your partition is mounted. To do this, you can use two commands:

# df -h
root@rescue-pro:~# df -h
Size Used Avail Use% Mounted on
/dev/vda1 4.7G 1.3G 3.2G 29% /
udev 10M 0 10M 0% /dev
tmpfs 774M 8.4M 766M 2% /run
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/vdb1 20G 934M 18G 5% /mnt/vdb1
# lsblk
oot@rescue-pro:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 254:0 0 4.9G 0 disk
└─vda1 254:1 0 4.9G 0 part /
vdb 254:16 0 20G 0 disk
└─vdb1 254:17 0 20G 0 part /mnt/vdb1

The image above shows that your system partition is mounted on /mnt/vdb1.

Step 3: CHROOT permissions

You now need to edit the root directory, for the changes to be applied to your system. You can do this by using the `chroot command. Please enter the following command:

root@rescue-pro:~# chroot /mnt/vdb1/

You can check by typing the ls -l command, which will list the content stored in the root directory of your system:

root@rescue-pro:/# ls -l

Step 4: change the root password

Now, you just need to change the root password with the passwd command:

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

Finally, reboot your VPS on its drive via your OVH or Hetzner Control Panel.

Have a Nice Day !

LEAVE A REPLY

Please enter your comment!
Please enter your name here