Join our Newsletter — 33% off our NHI Course
Home› FAQ› NHI Lifecycle Management› What should organisations do when SSH keys are…
NHI Lifecycle Management

What should organisations do when SSH keys are no longer needed but still grant access?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated September 24, 2026 Domain: NHI Lifecycle Management

Unused SSH keys should be identified, revoked, and disabled as part of a routine audit process. Teams should also confirm whether the corresponding private keys remain stored on endpoints, encrypted drives, or in scripts and configuration files. If the keys are still valid, they should be rotated or removed promptly to prevent dormant credentials from becoming an entry point into critical systems.

When SSH Keys Still Work, Why They Must Be Treated as Active Access

An SSH key that is no longer needed is still a live access path until it is revoked everywhere it is trusted. The key point is not whether the business still wants to use it, but whether it can still authenticate to systems, jump hosts, automation, or administrative accounts. Dormant keys expand the window for misuse, so the cleanup has to be deliberate and verifiable.

Unused keys often persist because they are copied into multiple places, shared across teams, or embedded in scripts and deployment tooling. That makes them easy to forget and hard to retire safely, especially when the corresponding private key has been cached on endpoints or stored in configuration files. If the key remains valid anywhere, it should be treated as active until proven otherwise.

For teams managing remote access at scale, the practical test is simple: can this key still open a session, and can you prove where it is still present? If the answer is yes, the organisation has an access control issue, not just a housekeeping issue. Revocation should therefore be paired with inventory, validation, and confirmation that no dependent automation still relies on the key.

What Proper SSH Key Retirement Involves

Key retirement is a lifecycle process, not a one-step delete action. Start by identifying where the key is authorised, then remove it from the server-side trust store, and then confirm that the private key is no longer available on the client side. That client-side check matters because a copied private key can still be reintroduced later unless the organisation also removes it from scripts, secrets stores, home directories, backup images, and configuration bundles.

Rotation is the right response when the key must remain in service during transition, because it preserves business continuity while changing the credential material. Removal is the better end state when the access path is no longer required at all. In both cases, the organisation should prefer a controlled audit trail over ad hoc manual deletion, since the value of the control comes from knowing that every trust point was updated.

A routine audit process should also distinguish between interactive use and automation use. An SSH key used by a human operator, a deployment pipeline, or a maintenance script may have different blast-radius concerns, but the retirement discipline is the same: confirm ownership, locate every copy, remove authorization, and verify that no system still depends on the key before closing the change.

How to Prevent Dormant SSH Keys From Becoming an Entry Point

The main failure mode is residual trust. A key that was created for a temporary task often survives after the task ends, and that stale access can later be found by an attacker, a former contractor, or an insider with indirect access to stored secrets. Once a private key is copied into scripts, cached on an endpoint, or left in an encrypted drive without access governance, the organisation may lose track of how widely it can still be used.

Another common failure is assuming that deleting one copy removes the risk. SSH access is only retired when all authorised destinations no longer trust the key and all usable copies of the private material are removed or rendered inaccessible. If that does not happen, the organisation has a hidden credential that may still work long after the original approval has expired.

Risk and Threat Considerations

Stale SSH keys create persistent access that can bypass normal review cycles and make compromise harder to detect. The risk increases when the same key has broad reach, is reused across systems, or is stored in places that are not routinely scanned for secrets and credentials.

Failure mechanism: The key remains trusted on one or more hosts while copies of the private material survive on endpoints, in automation, or in archived configuration. An attacker or former user who finds the private key can authenticate without needing to defeat the password or MFA controls applied to human logins.

Impact: Dormant access can become a low-friction path to sensitive systems, lateral movement, and privilege escalation, especially if the key was originally granted administrative or operational access.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 addresses the attack surface, CIS Controls v8 and NIST SP 800-53 Rev 5 set the technical controls, and ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
CIS Controls v8CIS-5 — Account ManagementSSH key retirement is an account/access lifecycle control.
Recommendation — Inventory and revoke obsolete SSH access paths on a routine schedule.
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementSSH keys are authenticators whose lifecycle must be managed and revoked.
AC-2 — Account ManagementSSH key cleanup depends on removing active account or access authorizations.
Recommendation — Rotate or revoke unused SSH keys and verify their remaining distribution. Disable the account or access path when the key is no longer required.
ISO/IEC 27001:2022A.5.15 — Access controlRetiring unused SSH keys is an access-control enforcement activity.
Recommendation — Remove access rights when SSH credentials are no longer needed.
OWASP Non-Human Identity Top 10NHI-01 — Improper OffboardingUnused SSH keys are a classic offboarding and access-removal problem.
NHI-07 — Long-Lived SecretsDormant SSH keys are long-lived credentials that keep granting access.
Recommendation — Ensure retired SSH keys are removed from every system and automation path. Shorten SSH key lifetime and eliminate keys that remain valid indefinitely.

Practitioner Guidance

What to verify: Do not close a key-retirement ticket until you have confirmed both sides of the lifecycle, the server-side authorisation entry is gone and no usable private copy remains in scripts, vaults, endpoints, or backups. If the key is embedded in automation, treat the dependent job as part of the retirement scope.

Decision rule: If the key still authenticates anywhere, rotate or revoke it immediately and then validate every dependent system before the next maintenance window. If the access is truly temporary or project-bound, set an expiry expectation up front so the cleanup is not left to memory.

Practitioner takeaway: The goal is not just to remove an obsolete key, it is to remove every remaining trust path that would let the key work again.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 24, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org