One of the advantages of a VPS or hybrid server is that they are virtualised, providing additional access to manage the server even if you are locked out of the root account.
You can use the out-of-band SSH console to get back into your server if you have forgotten the root password.
Getting an SSH Client
You will need an SSH client to access the out-of-band console.
If your computer is running OS X or Linux, you have the Terminal application already installed on your computer.
If your computer is running Windows, you will need to download a third-party SSH client, such as PuTTY.
Prepare Your Server
You will first need to turn your server off.
To do this:
- Log into your Customer Area
- Click ‘Manage VPS and Hybrid Servers’
- Click the icon next to the server you want to change the password for
- Click ‘Turn Off Server’
Log into Your Console
When you have turned off your server, you can now log in via the SSH console.
To get the login details:
- Click on the ‘Console’ tab in your server’s Control Panel
- Take the details from the ‘Text-based (SSH) console’ section
- Connect to your SSH console by entering username@ssh-host
- Add in the password (revealed in the Control Panel)
Boot the Server
Once you have logged into the console, you should see the following screen:
To boot the server:
- Enter ‘P’
- Wait for the server to boot
This screen shows the operating system choices. The top one is the default – the one that would normally start – but you want to start the server in single-user mode.
Single-user mode does not prompt you for a root login and allows you to change the password without prompting you for it.
To edit the boot parameters, allowing you to start the server in single-user mode:
- Press E
- Use the arrow keys to highlight the Kernel Boot Parameters
- Press E again
- Press space, then 1
- Press Enter
- Press B to boot the server
- The server will start booting in single-user mode
Resetting the Password
Once the server has booted up, you will see this:
Dependent on the Linux distribution, your file system may be read-only when loaded in single-user mode.
To check:
- Enter
mount
- Make certain that the / file system has (rw) or (ro) after it
- If the file system is read-only, it will say (ro), and you will need to switch it to writable
To switch the file system to writable:
- Enter
mount -o remount,rw /
To reset the root password:
- Enter
passwd
- Enter in your new password and press enter
- Enter in the password again and press enter
- Your new password will be saved
Reboot the Server
Once the password has been changed, you can reboot the server.
To reboot the server:
- Enter
reboot
- The server will reboot in normal mode