Skip to content

SSH Agent Access ​

Sets up key-only SSH login on a Debian or Ubuntu machine for an automated agent. It makes a keypair, installs the public key using an admin account, optionally creates the target user with passwordless sudo, and checks that key-only login works.

The sudo password is sent over SSH stdin, not on a command line or in a file.

Run it ​

Paste one line into a terminal, or a PowerShell window. Each one downloads the script and runs it.

bash (Linux, WSL, macOS):

bash
curl -fsSLO https://raw.githubusercontent.com/stlTechnology/ssh-agent-access/main/setup-ssh-agent-access.sh && bash setup-ssh-agent-access.sh

PowerShell (Windows 10 or 11):

powershell
irm https://raw.githubusercontent.com/stlTechnology/ssh-agent-access/main/setup-ssh-agent-access.ps1 -OutFile setup-ssh-agent-access.ps1; powershell -NoProfile -ExecutionPolicy Bypass -File .\setup-ssh-agent-access.ps1

It asks for the target host, the admin account, and the user to create. It will ask for the admin's password once, and for the sudo password only if the admin is not root.

Read it first ​

Running a script you haven't read is risky. Review the script before you run it, or clone the repo so you can read it locally: stlTechnology/ssh-agent-access.

Before you grant sudo ​

A passwordless sudo account has full root on the target. Only give it to an agent that needs it, and keep its key on the machine that uses it.

Test first ​

Run it on a disposable VM before you use it on a real server.

IT field notes from STL Net Services.