Virtual machines
Add SSH keys to a running VM
Give another key access to a Linux VM without a reinstall or restart.
Add keys from Settings → SSH keys to a running Linux VM. They are added to ~/.ssh/authorized_keys of the VM user, the one set at create or reinstall, and work right away.
Before you begin
- The VM is running.
qemu-guest-agentruns on the VM. It is installed on hostd images. If you removed it, install it again or add the key over SSH yourself.
Steps
- Open the VM and go to
SSH keys. - Select the keys to add, or add a new one with
+, and click Add. - Confirm it is you: enter the code from your authenticator app, or the code we send to your email if two-factor authentication is off. The confirmation lasts 15 minutes, so you can add keys to other VMs in that time without a new code. The page shows the user that received the keys.
Watch out
- Keys are only appended, nothing is removed. To remove a key, edit
~/.ssh/authorized_keyson the VM. - A reinstall sets only the keys selected in the reinstall form.
- In rescue mode the keys go to the temporary system and disappear when you disable it. Use this to sign in and fix
~/.ssh/authorized_keyson the system disk.