How to Configure Cursor SSH Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up cursor ssh prevent delete rules, restrict the remote Linux user and shell commands. You must pair editor prompt rules with strict server permissions on the target host. Many teams connect AI code editors to remote servers using standard developer keys. Those keys often carry full write and delete rights across the remote machine. If an AI agent misreads a prompt, it can wipe folders in seconds. Broad permissions turn a small mistake into a major outage for your team. How cursor ssh p

SSH Access Management + Cursor / AI IDE Security: 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 cursor ssh prevent delete rules, restrict the remote Linux user and shell commands. You must pair editor prompt rules with strict server permissions on the target host. Many teams connect AI code editors to remote servers using standard developer keys. Those keys often carry full write and delete rights across the remote machine. If an AI agent misreads a prompt, it can wipe folders in seconds. Broad permissions turn a small mistake into a major outage for your team.

How cursor ssh prevent delete works in native setups

Cursor connects to remote machines using your local OpenSSH client and keys. When the editor opens a remote folder, it starts a server process there. Every terminal command the AI runs uses that remote user account's permissions. By default, OpenSSH checks who can log in, not which commands run later. OpenSSH certificates hold a public key, identity info, user names, and signed options. A certificate authority key signs these items to verify the user or host. You can embed a forced command option inside an OpenSSH certificate or key file. That option runs a wrapper script instead of a full interactive shell session. The wrapper script inspects the incoming command string before the shell runs it. If the string contains a delete tool, the script blocks the action right away.

Teams also use Linux file permissions to block file drops on the server. You can create a dedicated Linux user account just for the AI editor. That account gets read and write rights on project files, but not delete rights. On Linux file systems, the sticky bit on a folder limits file removal. You can also set append-only file attributes on critical log and config files. Even if the editor sends a remove command, the kernel denies the call. In the editor, you can also enable manual review for terminal commands. This makes the developer click approve before the AI runs any shell line.

What native controls solve and what they miss

Linux file permissions and OpenSSH wrapper scripts stop simple file removal attempts well. They keep an unprivileged account from wiping system folders or shared project files. OpenSSH certificates also help teams avoid leaving static public keys on every host. Certificate login for users and hosts arrived in OpenSSH version 5.4 for this reason. These native tools decide which user logs in and which folders they touch.

Still, native server setups struggle with the way AI code editors actually work. First, the editor needs a working shell channel to load files and plugins. If you lock the SSH key to a strict wrapper script, the editor breaks. Its background helper scripts cannot start if the shell blocks standard shell syntax. Second, a Linux user who can edit a file can still empty it. Blocking file delete calls does not stop an agent from overwriting code with blanks. Third, developers get tired of clicking approve on every terminal prompt in the editor. Once a user enables auto-run mode for speed, client-side prompt checks stop working.

SSH Access Management + Cursor / AI IDE Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Why command filtering needs context

Shell commands can delete data in dozens of ways beyond standard remove tools. An agent can call Python, Perl, or Node scripts that unlink files directly. A simple text match in a wrapper script will miss these hidden calls. Teams also need clear logs of every command the AI agent sends over SSH. Native system logs often record the login event but miss the full command stream. Also, server logs can leak private data like emails, phone numbers, or card numbers. Native SSH servers do not rewrite matched fields in results before the agent reads them. To stay safe, teams need a way to check individual commands in flight. You want to allow normal file edits while pausing risky actions for human approval.

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 inline open-source SSH listener on the host where engineers and AI agents keep their normal ssh, sftp, and scp tools. On every production command or file operation, hoop.dev decides whether to pass, mask, block, or hold it for approval.

First, hoop.dev guardrails check one-shot commands and file paths before they run, and 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

Can I block delete commands using only editor settings?

Editor settings let you require manual approval before terminal commands run on the host. Still, users can change local settings, and agents can still run scripts that delete files.

Why do OpenSSH forced commands break remote code editors?

Remote editors launch background binaries and sync files over the same SSH channel. A strict forced command blocks those setup scripts and stops the editor from loading.

Does a read-only Linux user stop all AI damage?

A read-only user stops file drops, but the AI cannot write code either. If the user has write access, the agent can still overwrite file contents with empty text.

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.