How to Configure OpenAI Agents SDK SSH Permissions
You set up openai agents sdk ssh permissions by creating restricted Linux accounts and signing short-lived OpenSSH user keys. Then you give your agent tools only the exact host principals and shell commands they need to run. Many teams start by giving an AI agent a shared root key or a broad developer account. That shortcut lets a single bad prompt or tool error wipe files or read secret keys across every host. How to set up openai agents sdk ssh permissions The OpenAI Agents SDK runs Python
SSH Agent Forwarding Security + AI Agent Permissions: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up openai agents sdk ssh permissions by creating restricted Linux accounts and signing short-lived OpenSSH user keys. Then you give your agent tools only the exact host principals and shell commands they need to run. Many teams start by giving an AI agent a shared root key or a broad developer account. That shortcut lets a single bad prompt or tool error wipe files or read secret keys across every host.
How to set up openai agents sdk ssh permissions
The OpenAI Agents SDK runs Python functions as tools when a model decides to act. To let an agent run tasks on a remote server, engineers wrap an SSH client inside a tool function. The SDK itself does not manage remote host roles or network keys. Instead, your host operating system and OpenSSH server control what the agent can do after it logs in.
A safe setup starts on the target Linux host. You create a dedicated system user just for the agent task. You do not add this user to the sudo group or admin roles. File permissions on the server should limit this account to reading specific log folders or running one safe script.
Next, you replace static private keys with OpenSSH certificates. Added in OpenSSH 5.4, certificate login uses a Certification Authority key to sign a user public key. The signed certificate holds an identity name, allowed user or host principals, a validity window, and specific options. It uses a much simpler format than X.509 certificates. When you sign the agent key, you set a short time limit so the key expires soon.
You can also lock down the key or the authorized keys file with command options. OpenSSH lets you force a fixed command whenever a specific key logs in. Even if the model tries to send a different shell string, the server ignores it and runs the preset script. You should also turn off port forwarding, agent forwarding, and userrc files in the certificate options.
What native SSH setups solve and what they miss
Native Linux users and OpenSSH certificates solve the login problem well. They check who logs in and which host principals the key can reach. Time limits on signed keys stop old keys from working if someone steals them later. Forced commands work well when an agent only needs to run one fixed status script every time.
Still, real agent tasks often need more than one fixed script. Teams build agents to check live logs, inspect running processes, or fix broken app services. When you allow an open shell so the agent can pick different commands, static SSH rules fall short. OpenSSH decides if the agent may log in, not whether each shell command is safe in flight.
SSH Agent Forwarding Security + AI Agent Permissions: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Once an interactive session starts, the SSH server does not pause a risky command for human approval. It also does not inspect command output before that text returns to the language model. If a log file holds user emails, phone numbers, card numbers, or national IDs, raw output flows back to the agent. A production setup needs command checks and output masking that rewrites matched fields in results before the model reads them.
Separating read tools from write tools in the SDK
You can reduce risk further by splitting your agent tools by task type. Do not build one general SSH tool that takes any raw text string from the model. Instead, write separate Python functions for each small job, like checking disk space or reading app status. Each function should take strict, typed inputs and build the shell command inside your code.
Pair these separate tool functions with different Linux accounts on the target host. Give your read-only check tools a user key that can only view status and logs. Give restart or deploy tools a separate user key with narrow write rights on the app folder. This split keeps a routine check task from changing live system files.
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 on the host. It checks callers with OpenSSH certificates and works with ssh, sftp, scp, and rsync clients.
When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs. Then 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
Should an OpenAI agent ever use a static root SSH key?
No, an AI agent should never hold a root key or full sudo rights. Always create a dedicated Linux user with minimum file rights and use short-lived OpenSSH certificates.
How do OpenSSH certificates help secure AI agent tools?
A Certification Authority key signs the agent key with a strict identity, allowed principals, and an expiration time. You can also bake command limits and port forwarding bans right into the signed certificate.
Can native SSH permissions stop sensitive data from reaching the model?
No, Linux file permissions only allow or block access to a whole file. If an agent can read a log file, native SSH sends all raw emails or card numbers inside it.
Related guides
In this post