How to Configure Cline SSH Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up cline ssh prevent delete controls, restrict the remote Linux user and command scope. You pair local agent prompts with read-only server roles and OpenSSH command rules. Many teams let AI coding agents use a developer's own SSH key for remote tasks. That broad setup gives the agent full power to remove files, folders, or logs on hosts. When an agent runs a bad shell command, a broad role turns a mistake into data loss. How cline ssh prevent delete works with native controls Cline run

SSH Access Management + End-to-End Encryption: 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 cline ssh prevent delete controls, restrict the remote Linux user and command scope. You pair local agent prompts with read-only server roles and OpenSSH command rules. Many teams let AI coding agents use a developer's own SSH key for remote tasks. That broad setup gives the agent full power to remove files, folders, or logs on hosts. When an agent runs a bad shell command, a broad role turns a mistake into data loss.

How cline ssh prevent delete works with native controls

Cline runs shell commands on your machine to build code, check logs, and fix bugs. When the agent runs an SSH client command, it uses your local keys and host rules. The remote server does not know an AI agent typed the shell command. The host only sees the Linux user account and the public key or certificate used.

To stop file removal, teams first make a dedicated Linux user on the remote host. Admins give this user read permissions on log folders and app files. They remove write permissions on parent directories so the account cannot unlink or delete files. In Linux, deleting a file changes the parent directory, so directory write bits matter most.

Teams also use OpenSSH certificates to tighten how the agent logs in to hosts. A Certification Authority key signs a user public key to create an OpenSSH certificate. That certificate holds a public key, identity info, principal names, and signed options. OpenSSH added this simpler certificate format in version 5.4 to avoid complex TLS certificate setups. Admins can embed a forced command option inside the signed certificate or authorized keys list. When the session starts, the server runs only that preset script instead of an open shell. The wrapper script checks the incoming command string and rejects file delete actions.

Where local agent prompts fall short on remote hosts

Cline asks the user for permission before it runs a terminal command on your workstation. You can also set custom instructions that tell the model never to remove remote files. These local guardrails help catch obvious delete commands during normal coding work. Still, prompt instructions are only polite requests to a language model, not hard security rules.

An AI agent often chains several shell commands together inside a single SSH invocation. It might run a cleanup script, rotate a log file, or overwrite a target path. A human developer reviewing dozens of terminal prompts can miss a destructive step inside a script. Once the user clicks approve, the command goes straight to the remote server. If the remote Linux account has write access, the server runs the delete action right away.

SSH Access Management + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native SSH setup solves and what it leaves open

Dedicated Linux accounts and OpenSSH certificates solve the basic login problem well. They verify who can log in to a bastion or target host and set file boundaries. Certificate principals ensure an agent key only works for a specific low-privilege Linux user.

Still, native SSH and OS permissions leave a large operational gap during live debugging. Static file permissions are blunt tools that are hard to maintain across many servers. Sometimes an agent needs to restart a service or write a temporary test file. Giving the Linux user write access for that task also gives it power to delete files. Forced command wrapper scripts break easily when agents pass quotes, pipes, or subshells over SSH. Native SSH setup decides who logs in, not what each command does in flight. Plus, standard host logs do not tie individual remote commands back to a specific developer identity. Teams also cannot mask sensitive fields like emails, phone numbers, card numbers, or national IDs in output. When an agent reads remote logs, matched fields return in plain text unless rewritten in results.

Add command and file guardrails to SSH access

Host firewalls and certificate principals control who opens an SSH session. Yet an allowed user or agent can still run a bad one-shot command or pull sensitive files over sftp. In practice, hoop.dev sits inline on the host as an open-source SSH server with guardrails that uses OpenSSH certificates. For every one-shot command or sftp task an agent or human runs in production, hoop.dev decides to pass, mask, block, or escalate it for review.

Using hoop.dev SSH controls, guardrails check one-shot commands, env variable names, and sftp or scp paths before they run. Port forwards default to deny unless the target is listed. Because interactive shells have no statement boundary and carry no guardrails, teams can turn them off so every command is checked and logged. Check out the MIT-licensed project on GitHub.

Frequently asked questions

Can prompt rules alone stop Cline from deleting files over SSH?

No, prompt rules only guide the model and do not enforce system boundaries. You must remove directory write permissions on the remote host or inspect commands in flight.

How do Linux permissions stop an SSH user from deleting a file?

Linux controls file deletion through the write permission on the parent folder. If the remote user lacks write permission on that folder, it cannot remove files inside.

Why are OpenSSH forced commands hard to use with AI coding agents?

Forced commands run one fixed script per login and struggle to parse complex shell pipelines. Coding agents build varied multi-step commands that static bash wrappers often block by mistake or miss.

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.