How to Configure Claude Code SSH Read Only Access
You set up claude code ssh read only access by pairing a restricted Linux user with OpenSSH limits. This stops the AI coding agent from changing files or stopping services on remote hosts. Many teams start by giving the agent their own personal SSH keys on a laptop. That shortcut gives the model full write power if a remote shell command goes wrong. Broad permissions turn a minor prompt mistake into a major outage on a live server. How native claude code ssh read only access works Claude Code
Auditor Read-Only Access + Claude Code Security: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up claude code ssh read only access by pairing a restricted Linux user with OpenSSH limits. This stops the AI coding agent from changing files or stopping services on remote hosts. Many teams start by giving the agent their own personal SSH keys on a laptop. That shortcut gives the model full write power if a remote shell command goes wrong. Broad permissions turn a minor prompt mistake into a major outage on a live server.
How native claude code ssh read only access works
Claude Code reaches outside systems through Model Context Protocol servers or its local Bash tool. In Manual mode, the Bash tool asks for human approval before running most shell commands. Only a small built-in set of local read-only commands runs without a prompt. Still, when the Bash tool opens an SSH session, the local agent only sees one command. Once the remote shell opens, the remote Linux host must enforce all read-only rules.
To lock down the remote host, admins create a dedicated Linux user with no write rights. You place this user in a restricted group that can only read specific log folders. You also remove write bits on system files and leave the user out of admin groups. Next, you set up OpenSSH to log in that user with a signed user certificate. A certificate authority key signs the user public key and attaches a key identity. The certificate also lists the allowed principal names and sets a clear validity window.
Admins can also attach certificate options or authorized keys rules to limit what the session does. For example, a forced command script can check the incoming command string against a safe list. If the agent sends a basic log check or status read, the script lets it run. If the agent tries to edit a file or restart a daemon, the script blocks it.
Where native Linux and OpenSSH controls fall short
Native Linux permissions and OpenSSH certificates do a good job of controlling who logs in. They prove the identity of the caller and block direct file edits on the disk. Yet these host-level setups struggle to govern what individual commands do in flight across many machines. Keeping forced command wrapper scripts updated across dozens of Linux hosts takes constant manual work. Every time an engineer needs a new diagnostic flag, someone has to update the script.
Auditor Read-Only Access + Claude Code Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Standard read-only file permissions also cannot filter the text that comes back from a read command. A restricted user with read access to app logs can still print raw customer records. When the agent reads those logs, emails, phone numbers, and card numbers enter the model context. Linux file permissions only decide if a user can open a file or run a binary. They cannot rewrite sensitive fields in the command output before the AI agent reads them.
Finally, local SSH keys sit on the developer disk where any local process can use them. Even with a short certificate window, the agent can run approved commands without step-by-step checks. Teams lack a central audit log that links each remote command to a specific task.
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
How does Claude Code run commands on a remote SSH host?
Claude Code uses its Bash tool or an MCP server to open an SSH session. In Manual mode, the user must approve the initial SSH command before it runs.
Can OpenSSH certificates make an SSH session read-only by themselves?
No, an OpenSSH certificate only handles login identity, allowed principals, and session options. You must combine certificates with Linux file permissions or forced command scripts to block writes.
Why are read-only Linux permissions not enough for AI coding agents?
Read-only permissions still let the agent read sensitive config files and raw app logs. Without output masking, emails, phone numbers, and card numbers flow straight into the AI prompt.
Related guides
In this post