Lost credentials / Locked out
To manage your VPS, you normally log in using your SSH key. In case of a lost SSH key or a configuration error, you could get locked out of your system. This chapter describes two methods to recover access.
Option 1: Modify init application
Normally, when a VPS is booted, a standard "init" application is run, which is responsible for the normal boot process. It is possible to modify the init application and start a simple "shell" instead of the normal boot process. Once the shell is started, changes can be made to the file system.
Change init in the Service Centre
- In the VPSs overview, open the VPS settings with Manage VPS…
- Shutdown the VPS with Turn off (or Force off)
- Choose the Configuration tab
- Select the Update VPS button
- Open the Advanced options panel
- In the Kernel options field add
init=/bin/bash
- Click Save
- Boot the system with Turn on (under Console)
After booting, you will be dropped in a shell directly and are able to use the console on the panel to make changes. For instance, you could add the right key to the authorized_keys file.
Please note that the filesystem could be mounted in read-only. To be able to write changes to disk, execute the command mount -o remount,rw /
. After making the changes, remount in read-only again with mount -o remount,ro /
.
As there is no full operating system started, the system does not listen to a normal shutdown command. A Force off is required.
After this, remove the extra kernel parameter again (step 6) and boot the system normally.
Option 2: Make disk image available on another VPS
Alternative, or if more changes need to be made where it is desired to be able to login from SSH, it is also possible to access the disk from another VPS. In order to do so:
- Create a new (minimal) recovery VPS, give it a clear name, like 'recovery'
- Shutdown both the recovery and broken VPS
- In the menu on the left choose Disk images
- Find the disk image of the broken VPS and choose Manage…
- Change the assigned VPS to the recovery VPS one
- Choose the second Disk slot: Position 1 (xvdb1)
- Save the changes
Now you can boot the recovery VPS. You can login with SSH into that system and
access the disk of the broken VPS. The disk will be at /dev/xvdb1
. You can mount the disk of the broken VPS and make changes to the disk.
When you are done, turn the recovery VPS off again. Link the image back to the original VPS and boot that.
When your changes have been successful, you can remove the recovery VPS and its disk image to prevent unnecessary charges.