How to Configure Codex SSH Credentials
You set up codex ssh credentials by loading a private key into the local shell agent. The coding agent then uses that key to log in to remote hosts. Many teams share their own local keys with the coding tool. This practice gives the automated agent the same wide permissions as a human developer. If a prompt goes wrong, the agent can run bad commands across your servers. How codex ssh credentials work in practice AI coding tools run shell commands on your machine to finish tasks. When the agen
Ephemeral Credentials + SSH Access Management: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up codex ssh credentials by loading a private key into the local shell agent. The coding agent then uses that key to log in to remote hosts. Many teams share their own local keys with the coding tool. This practice gives the automated agent the same wide permissions as a human developer. If a prompt goes wrong, the agent can run bad commands across your servers.
How codex ssh credentials work in practice
AI coding tools run shell commands on your machine to finish tasks. When the agent needs to reach a remote server, it calls the standard SSH client. The SSH client looks for keys in your local directory or key agent. If the key matches the remote host list, the server opens a shell session.
Instead of static keys, some teams use OpenSSH certificates for user login. A certificate authority signs a public key to make a user certificate. This signed file holds the public key, an identity string, and valid user names. It also holds a set of options signed by the authority key. OpenSSH certificates use a simpler format than standard web TLS certificates.
When you sign a key, you set the identity and list the allowed user names. You can also set a time window so the key expires fast. If you do not set a time limit, the certificate stays valid forever. Using short time windows helps limit the risk of stolen files on developer laptops.
Why local key setup leaves a security gap
Setting up keys or certificates solves the basic login problem. The remote server knows which key or authority approved the session. It also maps the login to a specific Linux user account on the box. This stops strangers from logging into your private servers from the internet.
Still, login checks only decide who gets through the front door. Once the session starts, the SSH server does not check each command in flight. The AI agent gets the full power of that Linux user account. If that user can restart apps or delete files, the agent can too.
Static keys sitting on a disk also create a leak risk. Because the agent can read local files, a bad prompt might read the key file. Even if you use a local key agent, the tool can still open new sessions. Native SSH keys cannot mask sensitive values like emails, phone numbers, or card numbers. If the agent reads a log file with national IDs, that data enters the prompt. Teams need a way to check commands and mask data before output returns.
Ephemeral Credentials + SSH Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Steps to limit risk with agent keys
First, never let an AI agent use your personal admin key. Create a separate key pair just for the coding tool. Map that key to a restricted user account on the target server. Give that Linux user read permissions only on the folders it must check.
Second, use an OpenSSH certificate authority to sign the agent key. Set a short time limit when you sign the user certificate. Include options that turn off port forwarding and agent forwarding for that session. This stops the coding tool from pivoting to other hosts on your network.
Third, review what the agent wants to run before you approve the shell step. Manual review catches obvious mistakes, though it cannot catch every hidden script error. Combine strict user roles with network controls to keep remote hosts safe.
Inspect one-shot SSH commands and file tasks
SSH certificates and host rules decide who is allowed on a machine. Setup alone does not check single commands or block sftp reads on sensitive paths. By design, hoop.dev runs an inline open-source SSH listener on the host where engineers and AI agents keep their normal ssh, sftp, and scp tools. On every production command or file operation, hoop.dev decides whether to pass, mask, block, or hold it for approval.
First, hoop.dev guardrails check one-shot commands and file paths before they run, and hoop.dev data masking masks matched values in file downloads. The audit trail logs the certificate principal, requested action, and verdict without storing session content. Interactive shells carry no guardrails and can be turned off when every action must be checked. Explore the code on GitHub.
Frequently asked questions
Where should I store keys for an AI coding agent?
Load the key into your system key agent instead of leaving plain files on disk. This stops the coding tool from reading the raw private key file in a prompt.
Should an AI agent share my personal SSH key?
No, you should always make a separate key and user role for the agent. Sharing your own key gives the tool your full admin rights and hides who ran what.
How do OpenSSH certificates help with agent logins?
An authority key signs the agent key with a set identity and a short time window. Once the time window ends, the agent can no longer log in to the host.
Related guides
In this post