How to Configure Copilot Studio SSH Prevent Delete
To set up copilot studio ssh prevent delete controls, you must restrict the remote Linux user and lock down OpenSSH command rules. You also need to remove write permissions on target folders so the bot cannot remove files. Teams often give an AI agent a standard shell account to run remote tasks. When that account has broad write rights, a bad prompt can wipe out production files in seconds. How to set up copilot studio ssh prevent delete in Linux Copilot Studio reaches remote Linux servers t
SSH Access Management + Copilot Security Implications: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
To set up copilot studio ssh prevent delete controls, you must restrict the remote Linux user and lock down OpenSSH command rules. You also need to remove write permissions on target folders so the bot cannot remove files. Teams often give an AI agent a standard shell account to run remote tasks. When that account has broad write rights, a bad prompt can wipe out production files in seconds.
How to set up copilot studio ssh prevent delete in Linux
Copilot Studio reaches remote Linux servers through custom connectors, automation flows, or an on-premises bridge. Those workflows log in to the target host using an SSH key or certificate. OpenSSH checks the key and drops the session into a Linux user account.
By default, a normal Linux user can delete any file inside folders where it has write permissions. To stop file removal at the OS level, admins create a dedicated Linux user for the bot. Next, they set folder ownership to a different admin account and grant the bot read-only group rights.
For files that must never change or disappear, admins also set the immutable file attribute on Linux. Even if the bot tries to run a delete command, the Linux kernel blocks the action. You can also sign an OpenSSH user certificate with a Certification Authority key. OpenSSH certificates hold a public key, identity info, principal names, and signed options that limit what the session can do.
Why native OS and SSH rules leave a gap
OS permissions and OpenSSH certificate options solve who can log in to the host. They also set fixed boundaries on which folders a user account can touch. Still, many automation workflows need the bot to write new files or update logs in the same directory.
In Linux, directory write permission allows both creating new files and deleting old ones. If you give the bot write rights on a folder so it can drop a report, it can also delete files there. You can try to restrict the SSH key to a single wrapper script on the server.
SSH Access Management + Copilot Security Implications: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Yet maintaining custom bash wrapper scripts across dozens of hosts takes a lot of time. One small parsing mistake in a wrapper script can let a chained shell command slip through. Native SSH controls check the user at login, not what each command does in flight.
What happens when AI agents run remote shell commands
When an AI agent builds a shell command from user input, small wording changes can alter the command. A bot asked to clean up old temp files might target the wrong folder path. If the SSH session runs with broad folder permissions, the server runs the delete command right away.
Standard SSH logs only record that the bot logged in with a valid key. They do not show every command string or why the agent chose to run it. Also, command output from a server can contain customer emails, phone numbers, or card numbers. Without runtime checks, that sensitive text flows straight back into the AI chat history.
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 provides an open-source SSH server with guardrails on the host that uses OpenSSH certificates.
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 OpenSSH block only the rm command for a user?
No, OpenSSH does not have a built-in setting to block a single shell command like rm. It can only force the session to run one fixed command or script at login.
Does removing write permission on a file stop Linux from deleting it?
No, file deletion in Linux depends on the parent folder permissions, not the file itself. If the SSH user has write access to the folder, it can still remove a read-only file.
How can a bot write new files without being able to delete old ones?
At the Linux level, you can set the sticky bit on a shared folder and change file owners. For finer control over commands in flight, you must inspect and filter the SSH command stream before execution.
Related guides
In this post