How to Update Vultr SSH Keys

Updated on November 27, 2024

Updating a Secure Shell (SSH) key means replacing the public key from your Vultr account. Before updating the key, ensure you have a fresh SSH key pair. Then, keep the private key on your local device and copy the public key to your clipboard.

Follow this guide to update SSH keys using the Vultr Customer Portal, API, and CLI.

  • Vultr Customer Portal
  • Vultr API
  • Vultr CLI
  1. Navigate to Account and select SSH Keys under OTHER.

  2. Select the SSH key from the list and click the Edit Icon.

    Add SSH Key

  3. Enter the SSH Keys details and click Update SSH Key.

    SSH Key Details

  1. Send a GET request to the List SSH Keys endpoint to view all SSH keys and note the ID.

    console
    $ curl "https://api.vultr.com/v2/ssh-keys" \
        -X GET \
        -H "Authorization: Bearer ${VULTR_API_KEY}"
    
  2. Send a PATCH request to the Update SSH Key endpoint to update an SSH key.

    console
    $ curl "https://api.vultr.com/v2/ssh-keys/{ssh-key-id}" \
        -X PATCH \
        -H "Authorization: Bearer ${VULTR_API_KEY}" \
        -H "Content-Type: application/json" \
        --data '{
            "name" : "test-ssh-key",
            "ssh_key" : "ssh-rsa AAAAB3NzaC1yc2EA...."
        }'
    

    Visit the Update SSH Key endpoint to view additional attributes to add to your request.

  1. List all SSH keys and note the SSH key ID.

    console
    $ vultr-cli ssh-keys list
    
  2. Update the SSH Key by specifying the ID.

    console
    $ vultr-cli ssh-keys update ssh-key-id \
    --name="test-ssh-key" \
    --key="ssh-rsa AAAAB3NzaC1yc2EA...."
    

    Run vultr-cli ssh-keys update --help to view all options.