Changing SSH keys on a running server using the Customer Portal will reinstall and wipe all data on the server. You can manually change SSH keys without reinstalling the server by following this Quickstart Guide.
Deploy a new SSH key from a Linux or Mac workstation with ssh-copy-id
.
The ssh-copy-id utility is pre-installed on most Linux distributions. Mac workstations can install it via Homebrew, MacPorts, or using Curl.
Use the utility to add your public key to the server.
Specify the username and server IP address (or domain name) as shown. For example, the root user at 192.0.2.123:
$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.0.2.123
The utility will report some basic information and prompt for your password.
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/example_user/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.0.2.123's password:
Enter your password and the utility installs the key.
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@192.0.2.123'"
and check to make sure that only the key(s) you wanted were added.
Windows workstations can mimic the ssh-copy-id utility with a one-line PowerShell command. The example shown pipes the the public key through SSH from the current user's profile to the root user's ~/.ssh/authorized_keys.
PS> type $env:USERPROFILE\.ssh\id_rsa.pub | ssh root@192.0.2.123 "cat >> .ssh/authorized_keys"
There are no common automatic methods to delete a public key, you must remove it manually.
The Vultr API offers several endpoints to manage SSH keys.
For more information about managing SSH keys, see our other guides:
You could earn up to $300 by adding new articles