How to Configure Codex SSH Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up codex ssh read only access, create a restricted Linux user and bind an OpenSSH key to safe commands. This setup lets the AI coding agent inspect remote servers while blocking file edits or service restarts. Most teams start by giving an agent the same SSH key a human engineer uses. That broad role allows the agent to run any shell command on the host. If the agent misinterprets a prompt, it can delete files or change live system settings. How to set up codex ssh read only access with

Auditor Read-Only Access + SSH Access Management: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

To set up codex ssh read only access, create a restricted Linux user and bind an OpenSSH key to safe commands. This setup lets the AI coding agent inspect remote servers while blocking file edits or service restarts. Most teams start by giving an agent the same SSH key a human engineer uses. That broad role allows the agent to run any shell command on the host. If the agent misinterprets a prompt, it can delete files or change live system settings.

How to set up codex ssh read only access with OpenSSH

A safe setup starts on the target Linux host. First, you create a dedicated local user account just for the AI agent. You do not add this user to admin groups or grant sudo rights. Instead, you give this user read rights on specific log folders and app files. The operating system then blocks the agent from writing to system paths.

Next, you lock down how the agent logs in through OpenSSH. OpenSSH supports certificate login for users and hosts, which arrived in OpenSSH 5.4. You can use the key signing tool to sign a public key with a certificate authority key. Each signed certificate holds a public key, identity info, principal names, and a set of options. This format is much simpler than X.509 certificates. When you sign the user certificate, you set a key identity and list the allowed principal names. You also set a short validity window so the credential expires on its own.

To enforce read-only behavior at the SSH layer, you can restrict what commands the session runs. Admins often pair the agent key with a wrapper script on the host. When the agent opens a connection, the host runs the wrapper script instead of a full shell. The script checks the incoming command against a short list of safe read tools. If the agent asks to read a log or check disk space, the script runs it. If the agent tries to edit a file or chain a second command, the script drops the request.

What native SSH limits solve and what they miss

Host user permissions and OpenSSH certificates solve the login problem well. They prove which agent is logging in and block root commands on the machine. A dedicated Linux user also stops the agent from modifying system binaries or restarting services. For basic status checks, this native setup keeps the host OS safe from accidental writes.

Auditor Read-Only Access + SSH Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, native SSH setup only decides who logs in and which local files they can read. It does not inspect what happens inside the data stream once a command runs. A read-only user can still read plain text files that hold secrets or customer data. If the agent reads a production log, that log might contain emails, phone numbers, or card numbers. Native SSH sends that raw text straight back to the AI agent and its model provider.

Maintaining wrapper scripts across many servers also creates heavy toil for platform teams. Every time an engineer needs a new diagnostic flag, someone must update the script on every host. Shell parsers are hard to write, and tiny syntax tricks can let a command slip past a basic check. Finally, standard SSH logs only record that a login happened. They do not give you a clear audit trail of every command and output line across your fleet.

Check SSH commands and file transfers on the host

OpenSSH keys and certificates decide who can log into a Linux host. They do not check what a one-shot command or file transfer does once the session starts. With hoop.dev, you run an open-source SSH server with guardrails inline on the host. On every one-shot command or file transfer an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs, and hoop.dev data masking masks matched sensitive patterns in downloads and output. Interactive shells carry no guardrails because keystrokes have no statement boundary. Teams can turn interactive shells off and allow only commands and file tasks. The audit trail logs who connected and what was allowed or refused, without storing keystrokes or file bytes. See the source on GitHub.

Frequently asked questions

Can an OpenSSH certificate make a shell session read-only by itself?

No, an OpenSSH certificate only handles login identity, principal names, and session options. To block writes, you must pair it with Linux file permissions or a command wrapper script.

Why should AI agents use separate SSH principals from human engineers?

Separate principals let you limit the agent to read-only groups on the host. They also help your team tell agent actions apart from human work in system logs.

What happens if a read-only SSH user reads sensitive production logs?

Linux file permissions let the user read the entire file if they have read rights. Any emails, phone numbers, or national IDs inside that log will flow back to the agent unless masking rewrites matched fields in results.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.