To revoke an SSH key on a self-managed Linux VPS or VDS running OpenSSH, remove the matching public-key line from the authorized-key file for every server account where it was installed. The usual location is ~/.ssh/authorized_keys, but the server can be configured to use another path. Deleting the key from a hosting provider’s saved-key inventory—or deleting your local private-key file—does not by itself remove an authorization already installed on the server.
Before removing the key, protect your access
Keep your current administrative session open while you make the change. Before editing, confirm that you have another working administrator account or a provider console/recovery route. If you revoke the only working key and have no alternate access, you may need provider-specific recovery steps to get back in.
As an Amazon Associate I earn from qualifying purchases.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Make sure you know which login account uses the key. OpenSSH authorization is per account: removing a key from one user’s file does not remove it from another user’s file.
Remove the public key from the server
- Connect through a working access path. Sign in as an administrator using a key or other method that you intend to keep, or use the provider console.
- Find the target account’s authorized-key file. OpenSSH’s default is
~/.ssh/authorized_keysfor that account. The server’sAuthorizedKeysFilesetting can specify a different location, so check the effective SSH server configuration if the default file does not contain the key. See the OpenSSH sshd manual. - Identify the exact public-key entry. Compare the key type and key material with a trusted copy or fingerprint. A trailing comment, such as a device name, is only a label and does not prove the key’s identity.
- Remove only that entry. Delete the matching line, save the file, and check that the remaining authorized entries are intact. Repeat the check for any other server account where the same key may have been installed.
- Test from a new connection. Try to connect as the affected user with the revoked key, while leaving your existing session open until you have confirmed that your replacement access works. The revoked key should no longer authenticate that account through the file you edited.
Check every place that can still authorize the key
If the key still works in a fresh connection, do not assume the edit failed. Check whether it is present in another account’s authorized-key file or in a different path configured through AuthorizedKeysFile. Also consider whether a provider feature or configuration-management process is restoring the line. The actual path and controls depend on the server’s configuration and provider.
#1 Best Overall
- POWERFUL SECURITY KEY: The YubiKey 5 NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
- WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 NFC secures 100+ of your favorite accounts, including email, password managers, and more
- FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
- MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
- PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts
Removing an entry from one authorized-key file only addresses that account and file. It does not establish that the key is absent from other accounts, alternate configured locations, or systems that may recreate the entry.
Server authorization and provider key inventory are different
| Action | What it changes | What it does not establish |
|---|---|---|
| Remove the key from a server user’s configured authorized-key file | Whether that key is accepted for that account through that file | That the key is absent from other accounts, other configured files, or automation sources |
| Delete a saved key from a provider account | The provider’s stored key record for reuse or account management | That the public key was removed from existing servers. DigitalOcean explicitly says its doctl compute ssh-key delete command does not delete a key from any Droplets; its API deletion endpoint is likewise an account-inventory operation. See the DigitalOcean doctl command reference and DigitalOcean SSH keys API reference. |
Provider controls vary, so treat DigitalOcean as an example rather than a universal VPS or VDS workflow. To revoke access to an existing self-managed server, verify the server’s own authorization configuration.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #2
- POWERFUL SECURITY KEY: The Security Key NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
- WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key NFC secures 100 of your favorite accounts, including email, password managers, and more.
- FAST & CONVENIENT LOGIN: Plug in your Security Key NFC via USB-A and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
- TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
- BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.
Know what local key deletion does—and does not do
Deleting the private-key file from your laptop removes that local copy; it does not remove the corresponding public key from a server. Likewise, deleting a saved provider key is not a substitute for checking every target server account.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.If the key was lost or compromised
If you lost the only key that can access the server, use the provider’s documented recovery path. For DigitalOcean Droplets created with an SSH key, password authentication is disabled by default; DigitalOcean documents using its Recovery Console to restore SSH access. Its guidance includes OS-specific details, including additional configuration files for Ubuntu 22.04 and later and Debian 12 and later. Follow the current instructions for your provider and operating-system release: DigitalOcean Recovery Console guidance.
If you believe the key was exposed, remove its server-side authorizations and review other access that may also have been exposed. Rotate related credentials when appropriate, and confirm that no other account or configured key location still grants access.
Quick Recap
Best Value
- POWERFUL SECURITY KEY: The YubiKey 5 is a versatile physical passkey that protects your digital life from phishing attacks. It ensures only you can access your accounts.
- WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 secures 100+ of your favorite accounts, including email, password managers, and more.
- FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 via USB and tap it to authenticate. No batteries, no internet connection, and no extra fees required.
- MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it.
- BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




