- Generate an SSH key and copy it onto the server
- Give the server a public address or forwarded port
- Or stand up a VPN or bastion to reach it
- Connect inbound and hand the agent a shell
- Afterwards, revoke the key and close the port yourself
The machine has to be exposed to the outside, and it stays that way.