How to Configure Vercel AI SDK SSH Read Only Access
You set up vercel ai sdk ssh read only access by linking AI tools to a limited Linux user. That user must have no write rights on the host. Many teams start by giving an AI agent a normal key. This approach creates big risks if a bad prompt runs a delete command. A safe setup locks down the host account before the AI runs any task. How vercel ai sdk ssh read only access works The Vercel AI SDK lets language models call custom tools in your app. You define a tool that takes a shell command fro
Auditor Read-Only Access + SSH Access Management: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up vercel ai sdk ssh read only access by linking AI tools to a limited Linux user. That user must have no write rights on the host. Many teams start by giving an AI agent a normal key. This approach creates big risks if a bad prompt runs a delete command. A safe setup locks down the host account before the AI runs any task.
How vercel ai sdk ssh read only access works
The Vercel AI SDK lets language models call custom tools in your app. You define a tool that takes a shell command from the model. That tool opens an SSH session to a remote host and runs the command. The tool then sends the text output back to the model.
The SDK itself does not know if a command is safe or harmful. It just passes text to your Node code and waits for a reply. You must enforce read-only rules on the target Linux host.
Teams do this by creating a dedicated Linux user for the AI agent. You remove write rights from folders and files for that user. You can also assign a restricted shell that blocks path changes and file redirects. For key management, OpenSSH supports signed user certificates. A certificate authority key signs a public key with an identity and user names. It also embeds options and a time window for when the key works.
Why host user rules alone fall short for AI agents
Host user permissions decide who can log in and which files they can touch. They work well for stopping direct file edits or system crashes. A read-only Linux user cannot delete system logs or install bad packages.
Still, host rules leave a big gap during live sessions. Linux permissions do not check the meaning of each command in flight. A read-only user can still read sensitive files that hold app secrets. The AI agent might also read log files full of user emails or card numbers. Once the SSH tool returns that text, the SDK sends it to the model provider.
Static host setups also struggle when an AI tool needs one-time approval for a command. If you give the user more rights for one task, every prompt gets those rights. You also lack a clear log that ties each shell command to a specific AI user. Standard SSH logs show the Linux account name, not the app identity behind the prompt.
Auditor Read-Only Access + SSH Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Steps to lock down your agent shell tools
Start by splitting your AI tool definitions into small, strict actions. Do not give the model one open tool that runs any raw shell string. Build separate tools for checking disk space, reading app status, or viewing specific logs.
Next, validate all model inputs in your code before opening the SSH session. Check that the model only passes safe arguments like known service names. Reject any string that holds shell chaining characters or file redirects.
Finally, use short-lived OpenSSH certificates instead of static public keys on the host. When you sign a user certificate, set a short validity window. By default, OpenSSH certificates last forever unless you set a time limit. Short time limits make sure old keys cannot log in later.
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
Can the Vercel AI SDK block write commands on its own?
No, the SDK only routes tool calls from the model to your backend code. You must block write commands in your tool code or on the remote Linux host.
How do OpenSSH certificates help with AI agent security?
OpenSSH certificates let a central key sign user keys with a set identity and options. You can set a short time limit so the agent key expires fast.
What happens if a read-only SSH user reads sensitive log data?
The SSH tool sends the raw log output straight back to the AI model context. Unless you mask fields like emails or phone numbers, the model provider receives that data.
Related guides
In this post