October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Revoke an SSH Key on Your VPS or VDS Without Locking Yourself Out

Revoke an SSH key on a self-managed VPS or VDS by removing its public-key entry from each account where it is authorized, then test a fresh connection without closing your backup access.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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

  1. 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.
  2. Find the target account’s authorized-key file. OpenSSH’s default is ~/.ssh/authorized_keys for that account. The server’s AuthorizedKeysFile setting 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.
  3. 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.
  4. 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.
  5. 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
Yubico - YubiKey 5 NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-A or NFC, FIDO Certified - Protect Your Online Accounts
  • 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Yubico - Security Key NFC - Basic Compatibility - Multi-Factor Authentication (MFA) Key, Connect via USB-A or NFC, FIDO Certified
  • 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.Support on Ko-Fi

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Yubico - YubiKey 5Ci - Multi-Factor authentication (MFA) Security Key and passkey for iPhone/Android/PC, Dual connectors for Lighting/USB-C, FIDO Certified
  • 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.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.