How to Configure Claude Code SSH Approval
To set up claude code ssh approval, use Manual mode for the Bash tool. You can also require OpenSSH certificates for each remote host login. Engineering teams often let AI coding agents reach servers with local SSH keys. When those keys have broad permissions, a single bad command can break production systems. How claude code ssh approval works in practice Claude Code reaches external systems through Model Context Protocol servers and its Bash tool. When the agent needs to reach a remote host
Claude Code Security + Approval Chains & Escalation: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
To set up claude code ssh approval, use Manual mode for the Bash tool. You can also require OpenSSH certificates for each remote host login. Engineering teams often let AI coding agents reach servers with local SSH keys. When those keys have broad permissions, a single bad command can break production systems.
How claude code ssh approval works in practice
Claude Code reaches external systems through Model Context Protocol servers and its Bash tool. When the agent needs to reach a remote host, it runs shell commands. In Manual mode, the Bash tool pauses and asks the user for approval first. It only skips this prompt for a built-in set of read-only commands. For example, basic file listing and git status checks run without a prompt. Remote login commands are not on that built-in list, so they require user approval.
Teams pair this local prompt with OpenSSH certificate rules on the remote host. A Certification Authority key signs a user public key to create an OpenSSH certificate. That certificate holds identity details, principal names, and options inside a simple format. OpenSSH added this certificate method for users and hosts in version 5.4. When the developer approves the command, the local SSH client sends the certificate. The remote server checks the signature and principal name before opening the shell.
What native SSH and agent prompts solve and what stays exposed
Manual mode stops the coding agent from opening a remote shell on its own. OpenSSH certificates also help by proving user identity to the target server. Together, these controls decide whether the agent and user can log in.
Still, local prompts and host keys leave a major operational gap open. A local prompt only happens on the developer laptop before the command starts. If a user approves a broad script, they cannot see what runs next. Also, developers often grow tired of constant prompts and switch off Manual mode. Once the SSH session opens, the remote host trusts every command inside that shell. Native SSH login checks do not inspect individual commands while they run in flight. They also cannot mask sensitive fields like emails or phone numbers in command output. If an agent reads a customer file, raw card numbers flow right back into the model context.
Claude Code Security + Approval Chains & Escalation: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Why team-wide approval rules matter for remote commands
Relying on individual laptop settings makes security audits very hard for platform teams. One engineer might keep Manual mode on and read every shell command carefully. Another engineer might approve commands fast without reading the remote script content. Local coding agent checks also do not create a central log for security teams. When an incident happens on a host, you need to know who approved the action. Moving approval checks out of the laptop terminal gives teams consistent control over remote sessions.
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
Does Claude Code ask before running SSH commands in the Bash tool?
Yes, when you use Manual mode, the Bash tool asks for approval first. Only a small built-in list of local read-only commands runs without a prompt.
Can OpenSSH certificates limit who logs in from an AI agent?
Yes, a Certification Authority signs user certificates with specific principal names and options. The target server checks these signed details before it allows the login.
Why are local agent prompts not enough for production hosts?
Local prompts depend on each user checking commands on their own machine. They do not give central logs, peer review, or data masking for command output.
Related guides
In this post