Join our Newsletter — 33% off our NHI Course
Home› Glossary› Authentication, Authorisation & Trust› OpenSSH Authorized Keys
Authentication, Authorisation & Trust

OpenSSH Authorized Keys

← Back to Glossary
By NHI Mgmt Group Updated October 31, 2026 Domain: Authentication, Authorisation & Trust

OpenSSH authorized_keys is the file used to specify which public keys are allowed to authenticate to an SSH account. It acts as the server-side trust list for key-based login, so correct formatting and placement are essential for secure, reliable access control.

What the authorized_keys file does

OpenSSH uses authorized_keys as the server-side allow list for public-key login. Each line ties a presented public key to a specific SSH account, so the file is not just a convenience feature, it is part of access control. Its trust value depends on exact placement, syntax, ownership, and file permissions.

Because SSH key authentication is accepted only when the server can correctly read and trust this file, small mistakes can change who can log in or whether legitimate automation still works. A malformed entry, wrong path, or overly broad permissions can turn a secure control into an unreliable one.

How authorized_keys fits into SSH authentication

The file sits at the center of key-based SSH authentication: the client proves possession of the corresponding private key, and the server checks whether the matching public key is listed for that account. In practice, the file acts like an account-specific trust registry, which is why administrators often treat it as part of the account lifecycle rather than as a static text file.

That trust model is simple, but it is also brittle. If a key is added without ownership review, if a stale key is left behind, or if multiple teams share the same login path, the file becomes a long-lived access surface. For that reason, server-side SSH trust should be governed with the same care as other privileged access paths, including ownership, review, and revocation discipline.

NHIMG’s SSH Key and SSH Certificate Management Guide covers how authorized_keys, key sprawl, bastions, and orphaned keys fit into a broader key-governance model.

Common failure modes and operational edge cases

Most authorized_keys failures are not cryptographic failures, they are operational ones. The file can be ignored if it is in the wrong home directory, if its permissions are too open, if the sshd configuration disables public-key auth, or if a command restriction and the intended use do not match. The result is often either broken access or access that is more permissive than intended.

Another important edge case is delegation and automation. When teams reuse one key across multiple hosts or accounts, the file stops being a clean account control and becomes a hidden dependency. That pattern makes attribution, rotation, and emergency revocation harder, because a single key can grant access in more places than the original owner expects.

The same problem appears when administrators rely on manual edits without inventory. If nobody knows which keys are present, which application installed them, or whether they are still needed, removal becomes risky and slow. The operational consequence is that authorized_keys can silently accumulate access that no longer matches business need.

Linux Forensics Guide is useful when you need to investigate whether authorized_keys was altered during compromise or persistence activity.

Why authorized_keys matters for security and persistence

Because adding a public key is equivalent to granting login capability, authorized_keys is a common persistence mechanism after unauthorized access. An attacker who can modify the file may not need to steal a password again, because the server will continue to trust the inserted key until it is removed. That makes this file a high-value target in post-compromise scenarios.

The security significance is broader than simple account takeover. A planted key can preserve access through password resets, survive user awareness gaps, and create a quiet backdoor into administrative or automation accounts. In environments with many servers, that persistence can be difficult to spot if file integrity monitoring or host review is weak.

Compromise of the file also creates an identity hygiene problem: the trust relationship is between the account and the key, so stale or shared keys become part of the attack surface. If the key belongs to an automation workflow, a vendor, or an inherited admin account, the blast radius can extend beyond the original incident.

NHIMG’s MITRE ATT&CK T1098 Account Manipulation Guide explains why added SSH keys are treated as persistence and account manipulation activity.

Linux Fundamentals for Defenders Guide is also relevant because it places SSH keys in the wider context of Linux permissions, root access, and account governance.

Safe management practices for SSH trust lists

Good practice is to treat authorized_keys as governed access data, not as a convenience file. That means knowing who owns each key, why it exists, when it was last reviewed, and what service or person depends on it. For higher-risk environments, SSH certificates or centrally managed access patterns can reduce the operational burden of key sprawl.

Practitioners should also design for revocation. When a user leaves, a contractor finishes work, or an automation path changes, the old key must be removed everywhere it is trusted. Without that cleanup step, the file becomes a catalog of forgotten access paths rather than a control.

Detection matters as much as prevention. Changes to authorized_keys should be visible in host monitoring, and unexpected additions should be investigated as potential compromise, not dismissed as routine admin work. On compromised systems, review the file alongside shell history, login artefacts, and other persistence locations so you can determine whether the key was added deliberately or maliciously.

OpenSSH Server Hardening Guide provides the complementary server-side controls that make authorized_keys safer to operate.

Unix and Linux Privileged Access Guide helps frame SSH keys as part of broader privileged access governance rather than as an isolated login artifact.

osquery Guide can help defenders inventory authorized_keys across fleets and spot unexpected key material on hosts.

Risk and Threat Considerations

authorized_keys is attractive to attackers because it converts a one-time foothold into durable SSH access. If an intruder can add, replace, or preserve a key, they can often bypass password resets and return later through the same account, especially where privileged or automation accounts are involved.

Failure mechanism: The file becomes a persistence point when key additions are not tightly controlled, monitored, or removed after use. Shared keys, stale entries, and weak file oversight all make it easier for malicious access to survive normal account changes.

Impact: The result can be continued remote access, lateral movement, or unauthorized administrative activity on Linux systems. In larger environments, a single compromised trust list can expose multiple hosts, service paths, or operational workflows.

Standards & Framework Alignment

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

NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-5 — Authenticator Managementauthorized_keys is managed authenticator material for SSH access
IA-2 — Identification and Authentication (Organizational Users)SSH key login authenticates organizational users to accounts
AU-2 — Event LoggingSSH key additions and login events need audit visibility
Recommendation — Track, rotate, and revoke SSH public-key access material under IA-5. Use IA-2 to require strong user authentication before SSH access is granted. Log authorized_keys changes and SSH authentication events under AU-2.
CIS Controls v8CIS-5 — Account ManagementSSH keys are account access material that must be governed lifecycle-wise
Recommendation — Manage SSH key issuance, review, and removal through CIS-5 account controls.

Practitioner Guidance

Why practitioners should care: authorized_keys is often the simplest part of SSH to overlook and one of the easiest places for access to linger. Review it as an access-control object, not just a configuration file, and make ownership and removal explicit in your operating model.

Common misunderstanding: many teams assume that disabling passwords is enough to make SSH safe. In reality, a neglected authorized_keys file can preserve the same level of access long after the original business justification has disappeared.

Practitioner takeaway: build a routine for reviewing, inventorying, and removing SSH keys, because the security of key-based login depends on the trust list staying accurate.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

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