Your AI Agent Needs SSH Access, Not Your Identity

An AI agent needs to check a deployment. The convenient solution is to give it the same SSH access you use, let it fix problems, and stop interrupting it.

Convenient for the agent. Expensive when it makes the wrong decision.

Moving your private key into hardware is a useful improvement. But if the agent can still authenticate as you, reach every server you can reach, and run everything you can run, the biggest permission problem remains. You changed where the key lives. You did not change what the machine is allowed to do.

Give the agent enough authority to finish the job. Do not make it your digital replacement.

On this page
  1. A secure key can still authorize the wrong job
  2. Choose hardware by the failure you want to contain
  3. People and unattended jobs need different identities
  4. Your agent socket is an access surface
  5. Put the limit on the server, not in the prompt
  6. Recovery is part of the design
  7. Measure what the agent cannot do

A secure key can still authorize the wrong job#

Separate three questions: can someone copy the private key, can software ask it to sign, and what does the server permit after authentication? Different controls answer each question.

A strong passphrase protects an ordinary private-key file at rest. Hardware-backed signing can make copying local files insufficient to recreate the credential elsewhere. Neither automatically prevents software on an authorized machine from requesting a signature while the key is available.

A touch requirement adds human presence. It does not mean the person reviewed the remote command, inspected the deployment artifact, or approved the entire session that follows. Authentication proves something about access to a credential, not the wisdom of the next action.

That matters for automation. An agent can misunderstand a task without anyone stealing anything. An attacker can also abuse permissions without exporting a private key. Credential protection and authorization belong in the same design, but they are not interchangeable.

Choose hardware by the failure you want to contain#

Do not start with a shopping list. Start with the failure you want to make harder.

  • Portable human access: OpenSSH’s FIDO-backed key types combine a local handle with device-protected material. Resident credentials can make handles discoverable from a compatible authenticator. A remaining file is not necessarily an exportable private key, and deleting it is not a security metric.
  • Machine-bound access: ssh-tpm-agent can generate keys inside a TPM and store sealed key objects on disk. Those newly generated keys are bound to that hardware. Importing an existing software key is different: it does not erase copies that already existed.
  • Platform-protected signing: Apple’s Secure Enclave key model lets supported applications request operations without handling the plain-text private key. Hardware support, access-control settings and compatible SSH integration still matter; possession of a Mac is not a complete SSH configuration.

These mechanisms are not identical, and none makes a compromised endpoint harmless. Choose supported algorithms and implementations, then test the actual client, agent and server combination. The existing YubiKey SSH guide covers enrollment; the harder question here is which identity should be enrolled for which job.

People and unattended jobs need different identities#

A human administrator can respond to a presence check. A scheduled backup cannot. Sharing one identity between them turns a predictable conflict into pressure to remove the human check.

Do not solve that conflict by weakening the administrator’s credential. Split the identities.

Use a human identity for interactive administration and a separate workload identity for each meaningful automation role. A monitoring task should read its permitted status, not edit deployment scripts. A release task may need to install an approved artifact, but that does not require permission to modify the authentication policy.

The distinction is about authority, not which process happens to hold a key. A dedicated automation account with unrestricted administrator privileges is still unrestricted administrator access.

A hardware-bound, unattended workload key can be appropriate. Treat it as a machine credential with explicit limits, not as a human credential made convenient by removing prompts. If the host is compromised, assume its available signing capability can be exercised within those limits.

Your agent socket is an access surface#

Keeping private-key bytes away from an AI process is good. Giving that process an unrestricted signing socket can still give it the capability you meant to withhold.

The OpenSSH agent-restriction design explains this problem directly: a forwarded agent does not need to reveal the private key for another machine to request authentication signatures. A container boundary does not remove authority deliberately exposed through a mounted socket.

Keep the human signing agent outside the workload by default. If a connection only needs a jump host, consider ProxyJump rather than exposing the agent there. Where forwarding is genuinely required, destination constraints can narrow permitted use.

Those constraints require compatible components and correctly trusted host keys. They restrict authentication destinations, not the commands allowed after login. They also do not turn a permitted, compromised forwarding host into a trusted one.

The rule is simple: do not assess an agent only by the files it can read. Assess every capability it can call.

Put the limit on the server, not in the prompt#

A sentence telling an agent not to touch production is an instruction. A server refusing the operation is a control. Use both, but know which one survives a bad plan.

OpenSSH provides building blocks in its authorized-key options. A forced command can replace the command requested by the client. The restrict option disables forwarding, PTY allocation and user startup commands. Crucially, restrict alone does not prohibit arbitrary non-interactive commands: it is not a complete workload policy.

A constrained entry point must perform only the intended operation, validate inputs, and avoid turning client-supplied text back into a general shell. Its code and authorization files must not be writable by the account it constrains. Filesystem permissions and privilege-escalation rules must agree with that boundary.

SSH certificates can add bounded validity and named principals, but the issuer must authenticate the workload and apply a narrow policy. A short-lived credential with excessive authority is still excessive authority. The same distinction appears in job-scoped cloud access: temporary credentials do not rescue broad trust.

Expiry limits new authentication, not the lifetime of an already established session. Revocation, session termination and removal of persistence are different operational tasks. Do not advertise a five-minute certificate as a five-minute maximum incident.

Recovery is part of the design#

Device-bound credentials trade easy copying for dependence on a device. That is useful until a lost token or failed motherboard becomes the only route back into the system.

Enroll an independent recovery credential or establish a controlled administrative recovery path. Keep it separate from the primary device and test it without relying on an already authenticated connection. Two credentials lost with the same laptop are not much of a recovery plan.

Migrate one role and one target first. Keep the working administrative session open, test a fresh login, exercise recovery, and only then remove the superseded authorization. The goal is to retire unnecessary access, not win a race to delete files.

Measure what the agent cannot do#

A successful task is only half the acceptance check. On a controlled test target, confirm that the workload cannot request an unrelated command, use a forbidden destination, or alter its own permission boundary. Test expiry with a genuinely new connection rather than a reused authenticated session.

Record which identity performed which permitted operation and how access can be withdrawn. Keep secrets out of those records. An audit trail should explain an action, not become another credential store.

Pick one agent task today. Write down its target, allowed operation, credential lifetime and recovery owner. If any answer is effectively “whatever the human can do,” narrow it before changing hardware. Let the agent work independently inside a small permission boundary, not borrow your entire identity.

Comments

Leave a Reply

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