How to Configure OpenHands SSH Read Only Access
You set up openhands ssh read only access by pairing restricted Linux users with OpenSSH certificates. Then you limit the commands the AI agent can run on your remote host. Teams often give autonomous coding agents full shell keys to debug servers fast. Broad permissions let an automated tool change files, restart services, or read sensitive secrets. How openhands ssh read only access works on Linux hosts OpenHands runs tasks by opening a shell session and sending standard system commands. Wh
Auditor Read-Only Access + SSH Access Management: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up openhands ssh read only access by pairing restricted Linux users with OpenSSH certificates. Then you limit the commands the AI agent can run on your remote host. Teams often give autonomous coding agents full shell keys to debug servers fast. Broad permissions let an automated tool change files, restart services, or read sensitive secrets.
How openhands ssh read only access works on Linux hosts
OpenHands runs tasks by opening a shell session and sending standard system commands. When the agent connects to a remote server, it uses standard SSH keys or certificates. SSH itself does not have a single switch for a read-only mode. Instead, the remote Linux system controls what the logged-in user account can do.
To keep the agent from changing files, teams build a dedicated Linux user account. You remove this user from admin groups and take away write permissions on folders. You only grant read rights on specific log directories and app folders. You can also assign a restricted shell that blocks directory changes and file redirects.
Teams also use OpenSSH certificates to manage how the agent logs in. A certificate holds a public key, identity info, principal names, and signed options. You sign the key with a Certification Authority key and set a short validity window. You can also embed certificate options that force a specific command or block port forwarding. When OpenHands connects, the server checks the certificate signature and applies those login rules.
What native Linux and SSH controls solve and what they miss
Native Linux permissions and OpenSSH certificates solve the first part of remote server security. Certificates stop teams from leaving static public keys on dozens of production machines. A dedicated Linux user stops the agent from deleting system files or installing new packages. These controls decide who can log in and which folders they can open.
Still, host-level user rules leave a big operational gap during live debugging sessions. A restricted Linux user can still run heavy commands that spike CPU or memory. More importantly, read access to logs and app configs exposes raw sensitive data. If a log file contains customer emails, phone numbers, or card numbers, the agent reads them.
Auditor Read-Only Access + SSH Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Standard SSH setups only check identity at login and cannot inspect commands in flight. They do not pause risky shell commands for human approval before the server runs them. They also cannot rewrite matched fields in results to hide emails or national IDs. Teams must maintain custom wrapper scripts on every host to filter what the agent runs.
How to lock down agent shell commands in practice
Start by listing the exact diagnostic commands your AI agent needs to check server health. Most debugging tasks only need tools that view process lists, disk space, and recent logs. Group these safe commands on the target host and block everything else by default.
Next, separate log viewing from config reading so the agent does not touch secret files. Keep app keys and database passwords in files that the agent user cannot read. Test the setup by running a mock task from the agent workspace. Check the system auth logs to verify which principal name and key identity ran each command.
Add command and file guardrails to SSH access
Host firewalls and certificate principals control who opens an SSH session. Yet an allowed user or agent can still run a bad one-shot command or pull sensitive files over sftp. In practice, hoop.dev provides an open-source SSH server with guardrails on the host that uses OpenSSH certificates.
Using hoop.dev SSH controls, guardrails check one-shot commands, env variable names, and sftp or scp paths before they run. Port forwards default to deny unless the target is listed. Because interactive shells have no statement boundary and carry no guardrails, teams can turn them off so every command is checked and logged. Check out the MIT-licensed project on GitHub.
Frequently asked questions
Can OpenSSH certificates make an SSH session read-only by themselves?
No, an OpenSSH certificate only handles login identity, principal names, and basic session options. It can force a single command to run, which helps limit what the client does. True read-only file rules still depend on Linux file permissions or a restricted command script.
Why is a restricted Linux shell not enough for AI agents?
A restricted shell stops users from changing folders or setting new system paths. Still, if the agent can run standard text tools, it can still read raw secrets. It can also pull emails, phone numbers, or card numbers straight from app logs.
How should teams handle key rotation for OpenHands SSH tasks?
Instead of copying static public keys to servers, sign user keys with an OpenSSH CA. Set a short validity window when you sign the certificate so access expires on time. This keeps old agent keys from working after a debugging task finishes.
Related guides
In this post