How to Configure Claude Code SSH Audit Log
You set up a claude code ssh audit log by tracking host logins and shell runs. This setup pairs OpenSSH daemon logs with local agent approval checks on the client machine. Many teams let the coding agent use a developer key to reach remote servers. That broad setup makes it hard to tell human work from agent tasks. When an agent inherits a full shell key, it gains every permission that user holds. A stray command can change files, restart services, or read private data on the host. How a claud
Claude Code Security + Audit Log Integrity: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up a claude code ssh audit log by tracking host logins and shell runs. This setup pairs OpenSSH daemon logs with local agent approval checks on the client machine. Many teams let the coding agent use a developer key to reach remote servers. That broad setup makes it hard to tell human work from agent tasks. When an agent inherits a full shell key, it gains every permission that user holds. A stray command can change files, restart services, or read private data on the host.
How a claude code ssh audit log works in practice
Claude Code reaches external systems through Model Context Protocol servers and its built-in Bash tool. The Bash tool runs local shell commands, which can open remote SSH sessions. In Manual mode, the agent asks for approval before it runs most shell commands. Only a small built-in set of read-only commands runs without a manual prompt. Once you approve an SSH command, the local client reaches out to the remote server.
On the remote side, the OpenSSH daemon checks the key or signed certificate. OpenSSH added certificate support in version 5.4 to simplify key management for users and hosts. A Certificate Authority key signs a user public key to build a valid user certificate. That certificate holds a public key, an identity string, principal names, and specific options. When the server accepts the login, the system records the key identity in the host log. This log entry shows which user principal and certificate identity opened the remote connection.
Why host login logs miss in-flight agent commands
Native OpenSSH logs and signed certificates solve the first part of remote host security. They prove who logged in and which key or certificate opened the remote shell. Teams can also use a bastion or jump host to centralize network paths. This native setup gives you a clear record of when a session starts and ends. It also stops unknown keys from reaching private servers inside your network.
Still, login checks do not track what happens inside an active shell session. Once the SSH session opens, the remote server trusts the user account for every command. Standard login logs do not show every remote shell command the coding agent sends. Also, the remote host sends raw command output straight back to the local agent. If a file holds emails, phone numbers, card numbers, or national IDs, the agent reads them. Local manual prompts only check the initial command string before the remote connection begins. They cannot filter sensitive output or stop harmful subcommands inside an open remote script.
Claude Code Security + Audit Log Integrity: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Steps to tighten remote shell tracking for AI agents
First, give the agent a separate identity instead of sharing your personal SSH key. When you sign a user certificate, set a clear identity name for the coding agent. List only the specific user principals that the agent needs for its daily work. Always set a short validity window when you sign the certificate with your authority key. By default, OpenSSH certificates stay valid forever unless you define an expiration time.
Second, keep Claude Code in Manual mode when it uses the Bash tool for remote tasks. Check every SSH command string before you let the agent run it on a server. Verify that you trust each Model Context Protocol server before you use it for remote work. When the agent queries data, use a read-only user role so it cannot change records. Finally, collect your host logs in a central place so you can review login times. Combining separate certificates with manual command checks gives you a solid baseline for host tracking.
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 SSH commands on a remote host?
Claude Code runs remote SSH commands through its built-in Bash tool or Model Context Protocol servers. In Manual mode, the Bash tool asks for your approval before it opens an SSH connection.
Can OpenSSH certificates track which agent logged into a server?
Yes, you can sign a user key with a specific identity string using a Certificate Authority key. The remote server logs that identity string and the principal name when the session starts.
Do standard SSH login logs hide sensitive data from the agent?
No, standard SSH logs only record login events and key details on the host. They do not rewrite emails, phone numbers, card numbers, or national IDs in command results.
Related guides
In this post