How to Configure Make SSH Least Privilege

Published
Length
3 min read

Luis Felipe Dias

All posts

You configure make ssh least privilege by giving your automation tool a restricted Linux account. You also sign short-lived OpenSSH certificates that limit which commands the automation tool can run. Many engineering teams connect remote servers to automation platforms using shared root keys. This broad setup creates big security risks when a workflow fails or leaks credentials. If an attacker steals a static key, they gain full control over the host. How to configure make ssh least privilege

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 configure make ssh least privilege by giving your automation tool a restricted Linux account. You also sign short-lived OpenSSH certificates that limit which commands the automation tool can run. Many engineering teams connect remote servers to automation platforms using shared root keys. This broad setup creates big security risks when a workflow fails or leaks credentials. If an attacker steals a static key, they gain full control over the host.

How to configure make ssh least privilege in workflows

A safe setup starts on the target Linux host before you build your workflow. First, you create a dedicated local user account just for your automation tasks. You do not give this user full root rights on the server. Instead, you grant the account read or write rights only to specific folders. This stops the workflow from changing system files outside its assigned project directory.

Next, you replace static public keys with OpenSSH certificates signed by a certificate authority key. An OpenSSH certificate holds a public key, identity info, principal names, and signed options. This format is much simpler than the X.509 format used in web traffic. When the authority signs the key, it embeds rules right into the certificate. You set a validity window so the certificate expires after a short time. You also attach certificate options that force the session to run one specific script. Even if the automation tool sends another command, the server ignores it.

Choosing between static keys and signed certificates

Many teams start with static keys because they are fast to set up. You generate a key pair, copy the public part to the host, and connect. Still, static keys never expire on their own. Someone must log in to every server to remove old keys by hand. When teams manage dozens of servers and workflows, old keys often get left behind.

OpenSSH certificates fix this key sprawl by moving trust to a central authority key. The target host trusts the authority key instead of tracking individual user keys. Each certificate includes one or more principal names that must match the target user. You also add an identity string to every certificate during the signing step. The server writes this identity string into the system log on every login. This makes it easy to see which automation job logged in and when.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native SSH controls solve and what keeps the session active

Native OpenSSH certificates and restricted Linux users solve the initial login problem well. They ensure that only approved workflows log in to the right host account. Certificate options also turn off features like port forwarding or agent forwarding during the session. If a certificate leaks, its short validity window limits how long an attacker can use it.

Still, native host rules mainly check who logs in at the start of a session. Once a session starts, the server does not inspect the data flowing back and forth. If an allowed script queries a database, sensitive data can still flow back to the workflow. Native SSH logs also record login events rather than the full output of every command. Teams that need to rewrite sensitive fields like emails or card numbers in results need runtime controls. They also need a way to approve sensitive runs without editing host files on every machine.

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

Why should automation tools avoid using the root account over SSH?

The root account can read, change, or delete any file on the server. If a workflow has a bug or leaks its key, root access exposes the whole machine. A dedicated local user limits the workflow to only the files it needs.

How do OpenSSH certificates limit what a remote workflow can run?

When you sign a user certificate, you can embed specific command options into it. The SSH server reads these signed options when the workflow logs in. The server then runs only the pre-approved script and blocks all other shell commands.

What happens if you do not set a validity window on an OpenSSH certificate?

By default, an OpenSSH certificate stays valid forever if you skip the validity setting. A certificate that never expires carries the same long-term leak risk as a static key. Always set a clear start and end time when signing certificates for automation.

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.