How to Add and Delete SSH Keys

Updated on October 6, 2020
How to Add and Delete SSH Keys header image

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.


  • To follow this guide, you must have an SSH key in OpenSSH format. See our guide to create an SSH key.
  • This guide applies to Linux and BSD servers.
  • This guide is suitable for Linux, Mac, or Windows workstations.

Add SSH Key to Vultr Instance

Deploy a new SSH key from a Linux or Mac workstation with ssh-copy-id.

Linux and Mac workstations

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 correct public key with the -i [path to public key] parameter.

  • Specify the username and server IP address (or domain name) as shown. For example, the root user at

      $ ssh-copy-id -i ~/.ssh/ root@

    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/"
      /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@'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@'"
      and check to make sure that only the key(s) you wanted were added.

Windows workstations

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\ | ssh root@ "cat >> .ssh/authorized_keys"

Alternate method for any workstation type

  1. SSH to the server.
  2. Edit ~/.ssh/authorized_keys.
  3. Append your public key to the file.
  4. Save and exit.

Delete SSH Key

There are no common automatic methods to delete a public key, you must remove it manually.

  1. SSH to your server.
  2. Edit ~/.ssh/authorized_keys.
  3. Remove the line containing your key.
  4. Save and exit.

Manage SSH Keys via API

The Vultr API offers several endpoints to manage SSH keys.

  • Create a new SSH key for use with future instances. This does not update any running instances.
  • List all SSH keys in your account.
  • Get information about an SSH key.
  • Update an SSH key.
  • Delete an SSH key.

More Information

For more information about managing SSH keys, see our other guides: