How to Configure Goose SSH Least Privilege

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up goose ssh least privilege, give the agent a restricted OS account. Pair that account with short-lived OpenSSH certificates and strict shell command limits. Many teams start by giving their AI agent a developer SSH key. This shared key often holds broad root permissions across many servers. If the agent makes a mistake, a single bad command can break production systems. How to set up goose ssh least privilege A safe setup starts with a dedicated Linux user on each target host. You cr

Least Privilege Principle + SSH Access Management: 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 goose ssh least privilege, give the agent a restricted OS account. Pair that account with short-lived OpenSSH certificates and strict shell command limits. Many teams start by giving their AI agent a developer SSH key. This shared key often holds broad root permissions across many servers. If the agent makes a mistake, a single bad command can break production systems.

How to set up goose ssh least privilege

A safe setup starts with a dedicated Linux user on each target host. You create an account that only has read rights to specific log folders. This stops the agent from changing system files or reading secret app data. You also remove sudo rights so the agent cannot raise its own permissions.

Next, you replace static public keys with OpenSSH user certificates. OpenSSH added certificate support in version 5.4 using a simple key format. A Certification Authority key signs the agent public key to make a certificate. This certificate holds a key identity, valid principal names, and strict runtime options. You also set a short time window during the signing step. By default, OpenSSH certificates last forever if you do not set an expiry time. A short window makes sure the agent key stops working after the task ends.

You can also lock down what the certificate allows the agent to do. OpenSSH lets you bake options right into the signed certificate. You can block port forwarding, agent forwarding, and user terminal allocation. You can even force a single fixed command or script to run on login. When the agent logs in, the SSH daemon checks the CA signature and principal. The server then runs only the allowed script and closes the session.

Why native SSH setup is only the first step

Native OpenSSH certificates and Linux users solve the login problem well. They decide who can log in and which host accepts the key. They also cut down the work of copying public keys to every server. If you use a jump host, certificates help centralize where logins start.

Still, native SSH rules leave a big gap once the shell opens. Standard Linux accounts are either too strict or too open for AI tasks. If you lock a certificate to one script, the agent cannot explore new errors. If you give the agent a bash shell, you lose control over individual commands. Native SSH does not check what each command does while the session runs. An agent with read rights can still pull sensitive data from app logs. Customer emails, phone numbers, card numbers, and national IDs often sit in plain text. Without extra controls, those raw strings flow straight back into the model context.

Least Privilege Principle + SSH Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing command safety and sensitive data in flight

Teams running AI agents need controls that work inside the active session. You must inspect every command the agent sends before the host runs it. High-risk commands need a human check before they touch a live server. Low-risk read commands can run right away so the agent keeps moving.

You also need a way to clean command output on the way back. Data masking rewrites matched fields like emails and card numbers in results. This keeps sensitive strings out of third-party model prompts while letting the agent work. Detailed logs of every prompt and shell command also help security teams review actions.

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

Why should Goose not use a personal developer SSH key?

Personal keys usually have broad write rights and sudo permissions across many hosts. If the AI agent runs a bad command, it can delete data or break services. A separate key also makes it clear which actions came from the agent.

How do OpenSSH certificates help with goose ssh least privilege?

OpenSSH certificates let a central CA sign keys with a short expiry time. You can include principal names and command limits inside the signed certificate. The key stops working on its own when the validity window ends.

What can go wrong if Goose only has read permissions on a host?

Read permissions still let the agent read log files and app configs. Those files often hold secrets, emails, phone numbers, or card numbers. The agent can send that raw data to an external model provider.

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.