After buying a VPS, you may have forgotten your password. This tutorial is about to explain how to reset VPS password without root access. There is a time you may forgot your root password and you need to access to your system. It is a bad situation but don’t worry cause we will show you the way to solve this problem.
What Is the Role of Root Access On VPS?
Actually, root access on your VPS makes it possible to access to do anything on the server. A root user has full control over the server. It gives you permission to access and edit all files including system-critical files and do everything you want. To access as root user you should enter a specific password, But what if you forget it and you should reset your root password. what you are going to do!
Steps To Reset or Recover Password In VPS
In this section we are going to show you the major action to reset the root password. One of this method is via rescue mode. So follow the steps below to find out how you can do that:
Step 1- Reboot The VPS In Rescue Mode
First of all log in to your preferred control panel and reboot the VPS in rescue mode.
Step 2- Identifying The Mount Point
If you noticed before, on older VPS ranges, your partitions will be automatically mounted in rescue mode. For verifying this act you can use the following command and identify where your partition is mounted:
But if your VPS is in the current ranges, the MOUNTPOINT column should be empty. In this kind of circumstances, mount the partition first:
mkdir -p /mnt/sdb1 mount /dev/sdb1 /mnt/sdb1
Step 3- CHROOT Permissions
The next step you have to do is to edit the root directory to apply the changes to your system. You can do it by using the Chroot command:
To list the content which stored in the current directory of your system, you can use the following command:
Step 4- Changing the Root Password
And in the last part, change your password by using passwd command:
passwd New password: Retype new password: passwd: password updated successfully
Now if your VPS is in the current ranges, so instead of the default root account, you have initially received login credentials for a user with elevated permissions instead of the default “root” account. Also, the SSH service do not accept login requests as root.
So as the result, it is necessary to enter the username you actually use to login after passwd command:
Retype new password:
passwd: password updated successfully
With passing all these steps, you can login again by using this username after rebooting, in case root login is not available for you.
As the final words, reboot your VPS in “normal” mode in your control panel.
We hope by reading this article you learn how to reset VPS password without root access. You can use this method in the case you forgot your password. I hope you enjoy your reading. If you know any other way please share with us. Good Luck!