How to Configure Copilot Studio SSH Least Privilege

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up copilot studio ssh least privilege by giving your bot a strict OS user. You also bind its SSH key to fixed shell commands. Many teams start by giving a bot a broad admin key on a Linux host. That shortcut lets the bot run any shell command if a prompt goes wrong. A small mistake or bad input can then wipe files or leak secrets. How copilot studio ssh least privilege works Copilot Studio bots reach remote Linux hosts through custom connectors, actions, or background relays. The bot

Least Privilege Principle + 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 copilot studio ssh least privilege by giving your bot a strict OS user. You also bind its SSH key to fixed shell commands. Many teams start by giving a bot a broad admin key on a Linux host. That shortcut lets the bot run any shell command if a prompt goes wrong. A small mistake or bad input can then wipe files or leak secrets.

How copilot studio ssh least privilege works

Copilot Studio bots reach remote Linux hosts through custom connectors, actions, or background relays. The bot sends a request when a user asks a question in chat. A worker service takes that request and opens an SSH session to the target host. That worker needs a key to log in and run the right script.

To keep the host safe, you create a dedicated Linux user just for the bot. You strip away root rights and give that user read access to specific folders. Next, you use OpenSSH certificates instead of static keys that never expire. In OpenSSH, a certificate authority signs a public key with an identity and user name. The certificate also holds a validity window and strict options for that session. Certificate support arrived in OpenSSH 5.4 and uses a simpler format than TLS certificates.

You can also lock the bot to one script through the authorized keys file. OpenSSH lets you tie a public key or certificate to a single forced command. When the bot logs in, the SSH daemon ignores the command sent by the bot. It runs the pre-set script on the server instead. You should also turn off port forwarding and agent forwarding in those key options. This stops the bot from using the host as a stepping stone to other servers.

What native SSH limits solve and what they miss

Native OpenSSH rules do a great job of locking down who can log in. Certificates stop old keys from working forever when you set a short time limit. Dedicated Linux users keep the bot out of system files and other apps. Forced commands make sure an action only triggers a known script on the box.

Still, native SSH settings only check the user when the session starts. Once a bot needs to run five or ten different tasks, forced commands get messy. Teams either maintain dozens of separate keys or write a complex wrapper script. If that wrapper script takes arguments from the chat prompt, command injection becomes a risk. A user might trick the bot into passing bad text that breaks out of the script.

Least Privilege Principle + SSH Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

OS permissions also cannot see what data flows back to the chat window. If a log file holds emails, phone numbers, or card numbers, SSH sends them all. The bot reads that raw text and may show it to the person chatting. Native SSH logs also record login events, not the full output of every single command. When an audit happens, you know the bot logged in, but not what it read.

How to tighten bot sessions in practice

Start by listing every exact shell task your Copilot Studio action needs to run. Group read-only checks, like viewing disk space or app status, under one minimal OS account. Put any action that restarts a service or changes a file under a separate account. Never let the bot run an open shell where it picks the command string itself.

Sign short-lived OpenSSH user certificates for the worker that runs these bot tasks. Set the principal name on the certificate to match the locked-down Linux account. Turn off interactive terminal allocation if the bot only runs quick background scripts. Check your system logs often to see when the bot account logs in and out. Finally, add controls that check commands in flight and scrub sensitive fields from command output.

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 open-source SSH listener on the host where people and agents keep their normal ssh, sftp, and scp tools.

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

Should a Copilot Studio bot ever use a root SSH key?

No, a bot should never use a root key or full sudo rights. Always create a separate Linux user that can only read or run what the bot needs. If you need elevated rights for one script, scope sudo to that single file path.

How do OpenSSH certificates help with bot security?

OpenSSH certificates let a central authority sign a key with a clear end time. You do not have to copy new public keys to every server when keys rotate. If a bot worker gets compromised, the certificate expires on its own without manual cleanup.

Can native SSH hide sensitive data in command output?

No, OpenSSH only manages the encrypted tunnel and user login rules. It sends the exact output of a command straight back to the caller. To rewrite emails, phone numbers, or card numbers in results, you need a layer that inspects output.

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.