How to change ovh server password if forget

Step 1: Restart the VPS into rescue mode

Log in to your OVHcloud Control Panel and reboot the VPS in rescue mode. If you need further instructions about using rescue mode with a VPS, you may consult the rescue mode guide.

Step 2: Identify the mount point

The mount is created automatically. Use the following commands to identify where your partition is mounted:

Once you have successfully accessed your VPS via SSH, the first step will be to mount the partition to the Rescue Mode environment. We can find out which partition we need to mount using the following command:

# lsblk

Here is a sample output of this command:

sda 8:0 0 2.5G 0 disk
└─sda1 8:1 0 2.5G 0 part /
sdb 8:16 0 20G 0 disk
├─sdb1 8:17 0 19.9G 0 part
├─sdb14 8:30 0 4M 0 part
└─sdb15 8:31 0 106M 0 part 

This VPS has 20 GB of storage space. That means that the partition we need to mount is sdb1 since it contains 19.9 GB of storage and thus, contains the Linux filesystem. This partition will be in the /dev directory by default.

Note: The name of your partition may be different so follow the output of your system. In this article, we will call it sdb1.

After identifying the storage device, create a root directory within the /mnt directory, and then use the mount command to mount the partition to the Rescue Mode environment:

# mkdir /mnt/root
# mount /dev/sdb1 /mnt/root

Now, navigate to the newly mounted device and then use the chroot command to give yourself root access to the mounted filesystem:

# cd /mnt/root
# chroot /mnt/root

Now, we are able to change the root password using the following command:

# passwd

Leave a Reply

Related Articles

Back to top button
%d bloggers like this: