How to Configure Amazon Q SSH Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up amazon q ssh read only access by using restricted Linux accounts and forced command scripts. This blocks the AI coding agent from changing files or stopping services on your remote hosts. Many engineering teams let their local AI assistant use their personal SSH keys to inspect servers. That choice gives an automated tool full write rights across production hosts. If a prompt goes wrong, the agent can delete logs, restart processes, or change host files. How amazon q ssh read only a

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.

You set up amazon q ssh read only access by using restricted Linux accounts and forced command scripts. This blocks the AI coding agent from changing files or stopping services on your remote hosts. Many engineering teams let their local AI assistant use their personal SSH keys to inspect servers. That choice gives an automated tool full write rights across production hosts. If a prompt goes wrong, the agent can delete logs, restart processes, or change host files.

How amazon q ssh read only access works on Linux hosts

Amazon Q runs local shell commands on behalf of the developer during coding and debugging tasks. When the agent opens an SSH connection, the remote server checks the key and maps it to a Linux user. OpenSSH does not have a single switch that turns a normal shell into a read-only session. Instead, system admins combine a low-privilege OS user with an OpenSSH forced command script.

First, the admin creates a dedicated Linux user on the target host with no write rights. This account can read system logs and view process lists, but it cannot edit files or run admin tools. Next, the admin sets up an OpenSSH certificate or authorized key entry that runs a wrapper script. OpenSSH certificates hold a public key, identity info, principal names, and signed options from a certificate authority. When the agent connects, the SSH daemon ignores the requested command and runs the wrapper script instead.

The wrapper script reads the original command from the SSH session environment and checks it against an allowlist. If the command only reads data, like checking disk space or tailing a log, the script runs it. If the command tries to write files, change permissions, or open an interactive shell, the script drops the connection. This architecture keeps the AI assistant inside a strict set of safe inspection commands.

Why native SSH restrictions leave operational gaps

Using restricted Linux users and wrapper scripts solves the basic problem of raw root access. It stops an agent from running obvious destructive commands on a host. Still, maintaining these scripts across dozens or hundreds of servers takes constant manual work. Every time a team needs a new read command for debugging, someone must update the wrapper script everywhere.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Shell parsing in a wrapper script is also fragile and hard to secure. Attackers or confused agents can use flags, pipes, or subshells to slip write actions past simple text checks. A command that looks safe at first glance might still read secret keys or dump memory files. Standard Linux file permissions often let any local user read config files that hold database passwords or API tokens.

Native OpenSSH setups also struggle to hide sensitive customer data inside command output. When an agent reads an app log, the raw text flows straight back to the AI model context. If that log holds emails, phone numbers, card numbers, or national IDs, the agent ingests those raw values. Finally, host-level SSH logs only record that a login happened, not the full output returned to the agent. Teams are left without a clear central audit trail of every command and result across their fleet.

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 open-source SSH listener on the host where people and agents keep their normal ssh, sftp, and scp tools.

First, hoop.dev guardrails check one-shot commands and file paths before they run. Next, 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

Can OpenSSH natively enforce a read-only shell session?

No, OpenSSH only handles user login and passes the session to the host operating system shell. To restrict actions, you must use OS file permissions, restricted shells, or a custom forced command script.

Why shouldn't Amazon Q use a developer's personal SSH key?

A developer's personal SSH key usually grants broad write and admin rights on remote servers. Sharing that key with an AI agent means a bad prompt can alter configs or break live services.

How do sensitive fields leak during read-only SSH sessions?

Read-only Linux users can still view app logs and config files that contain raw user data. Without output filtering that rewrites matched fields in results, emails and card numbers flow straight to the agent.

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.