How to Configure Dify SSH Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up dify ssh read only access by pairing restricted Linux users with OpenSSH certificates. Then you connect your Dify workflow to that restricted account for safe system checks. Most teams start by giving an AI agent a normal SSH key on a host. That broad setup lets a bad prompt delete files, change services, or steal private data. How to set up dify ssh read only access First, you create a dedicated Linux user on your target host for the AI agent. You strip write rights from this user

Auditor Read-Only Access + 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.

You set up dify ssh read only access by pairing restricted Linux users with OpenSSH certificates. Then you connect your Dify workflow to that restricted account for safe system checks. Most teams start by giving an AI agent a normal SSH key on a host. That broad setup lets a bad prompt delete files, change services, or steal private data.

How to set up dify ssh read only access

First, you create a dedicated Linux user on your target host for the AI agent. You strip write rights from this user across all system folders and app files. Next, you place this user in a group that can only read specific log files. Linux file permissions stop the agent from changing settings or writing new scripts to disk.

Second, you replace static SSH keys with OpenSSH user certificates for logging in. OpenSSH added certificate support for users and hosts in version 5.4. A Certification Authority key signs the user public key to build a simple certificate. That certificate holds the public key, an identity name, valid user principals, and strict options. When you sign the key, you set a short time window for the session.

Third, you add command limits to the signed certificate or the authorized keys file. This setup forces the SSH server to run one fixed script when Dify logs in. The script checks the command from the Dify tool node against an allowed list. If the agent asks to check disk space or read logs, the script runs it. If the agent asks to change a file, the script blocks the action right away.

What native SSH limits solve and what they miss

Native Linux roles and OpenSSH certificates solve the basic login problem for AI tools. Certificates stop static private keys from sitting inside Dify tool settings forever. Linux file modes stop the agent from changing system files or restarting running apps. Forced scripts also keep the agent from running random shell tools on your server.

Auditor Read-Only Access + SSH Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, host setup only decides who logs in and which local files they can touch. It does not inspect what individual commands return to the AI model in flight. A read-only user can still read plain text files that hold live secrets. It can also pull customer emails, phone numbers, card numbers, or national IDs from logs.

Once the SSH session sends that output back, Dify passes it to the language model. Data masking is needed to rewrite matched fields in results before the model reads them. Maintaining custom wrapper scripts across many servers also takes a lot of team time. One tiny mistake in a shell script can let an AI prompt bypass your rules. Teams also lack a central place to approve risky commands before they run.

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 OpenSSH make a session read-only by itself?

No, OpenSSH only handles the login and the initial command trigger on the host. You must use Linux file rules or custom scripts to block write actions.

Why use OpenSSH certificates instead of static SSH keys for Dify?

Static keys stay valid until someone removes them from the target server by hand. OpenSSH certificates let you set an expiration time and embed user principals and options.

What is the biggest risk of read-only SSH for AI agents?

A read-only account can still read system logs and config files with private data. Without data masking, the AI agent pulls emails, card numbers, or secrets into prompts.

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.