---
title: How to Add and Delete SSH Keys
url: https://docs.vultr.com/how-to-add-and-delete-ssh-keys
description: Learn how to securely add and delete SSH keys for passwordless authentication. Step-by-step guide for managing SSH keys on various operating systems.
publish_date: 2020-10-06T00:00:00Z
last_updated: 2026-04-15T00:00:00.077250Z
header_image: https://assets.vultrdevrel.com/docs-main-doc-assets-1/788/00c397d1cba1e1f9.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

Changing SSH keys on a running server [using the Vultr Console](https://console.vultr.com/) will reinstall and wipe all data on the server. You can manually change SSH keys without reinstalling the server by following this Quickstart Guide.

## Prerequisites

* To follow this guide, you must have an SSH key in OpenSSH format. See [our guide to create an SSH key](https://docs.vultr.com/how-do-i-generate-ssh-keys). 
* 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](https://www.ssh.com/ssh/copy-id#ssh-copy-id-on-mac).

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 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

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"

### 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](https://www.vultr.com/api/v2/#operation/create-ssh-key) a new SSH key for use with future instances. This does not update any running instances.
* [List](https://www.vultr.com/api/v2/#operation/list-ssh-keys) all SSH keys in your account.
* [Get](https://www.vultr.com/api/v2/#operation/get-ssh-key) information about an SSH key.
* [Update](https://www.vultr.com/api/v2/#operation/update-ssh-key) an SSH key.
* [Delete](https://www.vultr.com/api/v2/#operation/delete-ssh-key) an SSH key.

## More Information

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

* [How to Generate SSH Keys](https://docs.vultr.com/how-do-i-generate-ssh-keys)
* Deploy a New Server with an SSH Key
* [Connect to a Server Using an SSH Key](https://docs.vultr.com/connect-to-a-server-using-an-ssh-key)
* Use an SSH Key for Non-root Users
