How to Configure CrewAI SSH Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up a crewai ssh sandbox, pair restricted Linux accounts with OpenSSH certificates. Give the agent tool a limited shell user on a separate host. Many teams start by giving agents standard SSH keys and wide host permissions. That approach creates big risks when an agent generates bad shell commands. A small mistake in a prompt can wipe files or expose secrets. How to set up a crewai ssh sandbox A safe setup starts with how the agent logs in to the remote host. Static keys sit on disk for

SSH Access Management + AI Sandbox Environments: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

To set up a crewai ssh sandbox, pair restricted Linux accounts with OpenSSH certificates. Give the agent tool a limited shell user on a separate host. Many teams start by giving agents standard SSH keys and wide host permissions. That approach creates big risks when an agent generates bad shell commands. A small mistake in a prompt can wipe files or expose secrets.

How to set up a crewai ssh sandbox

A safe setup starts with how the agent logs in to the remote host. Static keys sit on disk forever and are hard to track. OpenSSH certificates solve this by signing a public key with a certificate authority key. Each signed certificate holds a public key, an identity name, and valid user principals. It also carries a set of options signed by the authority key.

You can set a short time window on each user certificate. If you skip the time window, the certificate stays valid forever. Short time windows help limit the risk of leaked agent keys. When the agent needs to run a task, it uses this signed certificate. The target server checks the authority signature before it allows the login.

Next, lock down the Linux account on the target host. Create a dedicated user account just for the agent crew. Do not put this user in admin groups or give it root rights. Place the user in an isolated directory with read rights only where needed. You can also set OpenSSH certificate options to limit what the session does. This keeps the agent inside a tight boundary on the remote machine.

What native SSH limits solve and what keeps the session active

Native OpenSSH rules and Linux user permissions solve the first part of host safety. They decide who can log in and which files the user can touch. Certificate identities also show which agent key opened a specific connection in host logs. If a key expires, the agent can no longer log in to the box.

Still, host login checks do not watch what happens inside an active shell session. Once the agent logs in, it can run any command allowed for that user. A confused agent might still run a harmful script inside its own home folder. It might also read local text files that hold emails or phone numbers. Standard SSH logs show the login event, not every command or output line.

SSH Access Management + AI Sandbox Environments: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Why agent shell sessions need command and data checks

AI agents build shell commands on the fly based on task goals. Even without root rights, an agent can delete work files or loop forever. Teams often need a person to check risky commands before they run. Native SSH certificates can lock an account to one preset command at login. Yet agents often need to run varied commands to finish a task.

Data leaks in command output are another problem for agent workflows. When an agent reads a log file, the output goes back to the model. That text might hold card numbers, national IDs, or private emails. Without output filtering, those fields go straight into the model context. Masking rules that rewrite matched fields in results help keep sensitive data safe.

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

How do OpenSSH certificates beat static SSH keys for agents?

OpenSSH certificates let you sign a public key with an authority key and identity. You can set a short time limit so the agent key expires fast.

Can Linux user permissions stop all bad agent commands?

No, Linux permissions only block actions outside the user role. The agent can still delete its own files or read sensitive data it owns.

How can teams keep sensitive data out of agent prompts during SSH tasks?

Teams can apply masking rules to the shell output stream. Masking rewrites matched fields like emails or card numbers in results before the agent reads them.

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.