Change the root password on a VPS (Linux)

This guide presents two scenarios:
    • changing the root password. This is when you
know your password for your current VPS
  • Resetting the root password, when you have lost it

Changing the root password

 
To change the root password, you must:

  • log in as root to the VPS using using SSH.
  • Launch passwd command:
 
 
 
[root@vpsxxxxx ~]# passwd

Type the new password (it will not show on screen as you are typing it)

Changing password for root user.
New password:
Retype new password:

A confirmation message will appear:

passwd: all authentication tokens updated successfully.

To test the new password, just log out and back in again in SSH.
 
 

Resetting root password

 
To change the VPS root password via rescue mode, you have to: 

  • Restart the VPS in Rescue Mode:
In your customer account, select your VPS, switch to Expert mode, then press Restart
  • Log in, in SSH with the Rescue access codes received via email.
 
 
 
On a Cloud VPS, before going any further, you have to mount the partition by launching the following command:

[root@rescue ~]# mount /dev/vda1 /mnt
Please note: On a VPS 2014 model, use sda1 instead of vda1.

Then, do a chroot on the mount made:

[root@rescue ~]# chroot /mnt

After this you will be able to continue with the password change.
 
 
 
Launch the passwd command:

[root@vpsxxxxx ~]# passwd

Type the new password (it will not show on screen as you are typing)

Changing password for root user.
New password:
Retype new password:

A confirmation message will appear:

passwd: all authentication tokens updated successfully.

To test the new password, just log out and back in again in SSH.
  • 2 gebruikers vonden dit artikel nuttig
Was dit antwoord nuttig?

Gerelateerde artikelen

How to use Docker to optimise a WordPress website hosted on a VPS

Docker is an open-source container technology best known for simplifying the workflows of...