How to Configure GitHub Copilot SSH Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up github copilot ssh prevent delete rules by locking down Linux user accounts and remote shell commands. You must also enforce strict confirmation steps before the coding assistant runs any terminal task. Many engineering teams let their coding assistant use a personal SSH key to reach remote servers. That key often maps to a remote user account with full write or admin rights. When a model suggests a cleanup command, a broad account can wipe critical files in seconds. How github copi

SSH Access Management + GitHub Actions Security: 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 github copilot ssh prevent delete rules by locking down Linux user accounts and remote shell commands. You must also enforce strict confirmation steps before the coding assistant runs any terminal task. Many engineering teams let their coding assistant use a personal SSH key to reach remote servers. That key often maps to a remote user account with full write or admin rights. When a model suggests a cleanup command, a broad account can wipe critical files in seconds.

How github copilot ssh prevent delete works in native setups

GitHub Copilot runs shell commands through the local terminal inside the code editor. When a developer asks the assistant to check a remote host, it invokes the standard SSH client. That client uses whatever local keys and agent sockets belong to the human user. The remote server cannot tell if a human or an AI typed the command. To block file deletion natively, admins must restrict the remote Linux account itself.

Admins start by creating a dedicated remote user account for fixing and status checks. They remove that user from admin groups so it cannot run privileged system tasks. Next, they set strict Linux file permissions on app folders and log directories. The restricted account gets read rights on logs, while only the service account gets write rights. If the assistant tries to remove a protected file, the operating system rejects the request.

Teams also use OpenSSH user certificates to attach strict options to a login key. A certificate authority signs the public key and adds principal names and command rules. When the user logs in, the SSH daemon reads the certificate and runs a wrapper script. That script inspects the requested command string before passing it to the local shell. If the string contains a file removal tool, the script stops the task right away.

Why native SSH restrictions leave an operational gap

Linux file permissions and wrapper scripts solve basic read-only access for simple inspection tasks. They keep a read-only account from wiping system files or dropping whole folders. Still, developers rarely want a coding assistant that can only read static files. Teams often ask the assistant to restart services, clear temp caches, or update app settings. Those tasks require write access to specific folders on the remote Linux host.

Once an account has write access to a folder, basic Linux permissions cannot tell good writes from bad writes. A user account that can write a new file in a directory can also delete files there. Wrapper scripts also struggle to parse complex shell syntax and chained commands. A script that checks for simple removal words can miss subshells, loops, or file truncation tricks. Native SSH controls decide who logs into the server, not what each command does in flight.

SSH Access Management + GitHub Actions Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Best practices for safer AI remote shell tasks

You can reduce the risk of accidental deletions by separating human keys from assistant tasks. Never let an automated coding agent share your primary admin SSH key or bastion setup. Create a separate SSH profile that points to a low-privilege user on the remote host. Keep editor approval prompts turned on so a human reviews every terminal command before it runs.

For sensitive production servers, avoid giving raw shell access to local coding tools at all. Require explicit human sign-off whenever a session needs to change files or run cleanup scripts. Also make sure your team logs every command string along with the identity of the caller. Clear logs help your team spot risky agent behavior before it damages a live system.

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 inline on the host. On every one-shot command or file transfer an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs, and 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 GitHub Copilot delete files over SSH by itself?

Yes, if you allow automatic terminal execution and your SSH key maps to a user with write rights. Keeping manual command confirmation turned on in your editor adds a human check first.

Do OpenSSH certificates block file deletion commands on their own?

No, an OpenSSH certificate only handles login identity and session options like forced commands. You must pair the certificate with a custom shell wrapper or Linux permissions to block deletes.

Why can a shell wrapper miss some delete commands over SSH?

Linux shells offer many ways to remove data, including file redirection, scripting languages, and archive tools. Simple text matching in a wrapper script cannot catch every way a command erases data.

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.