Connect over SSH
Every machine runs an SSH server. You reach it through your region’s jump host: the jump
host checks your key and forwards the connection, and the SSH session itself runs between
your machine and the machine. So scp, rsync, port forwarding and agent forwarding work as
usual, and your client checks the machine’s own host key.
Connecting to a suspended machine resumes it; the first connection then takes a little longer.
Add your SSH public key
Only ed25519 and ECDSA keys are accepted; RSA keys and security-key (sk-) keys
are refused. If you have no ed25519 key yet:
ssh-keygen -t ed25519Add the public key (~/.ssh/id_ed25519.pub or ~/.ssh/id_ecdsa.pub) in the portal under
Account → SSH keys, and remove it there too. space ssh-keys list shows your keys, but
the CLI cannot add or remove one: an SSH key opens the machines of every project of your
organizations, and an API key works in the projects it reaches.
A key belongs to you, not to one machine: it works for every machine in every organization you are a member of, including machines that are already running. Removing it takes effect the same way.
In an organization where your role is Member, your keys reach none of its machines: SSH is for developers, admins and owners. When an admin changes your role, your keys are added to or taken off its machines at once.
Connect
space ssh devYou log in as root. Everything after the machine’s name goes to ssh: options first, then
an optional remote command:
space ssh dev -L 8080:localhost:8080 # forward a port
space ssh dev uname -a # run one command
space ssh dev -A # forward your SSH agentIf the first thing after the machine name is one of space’s own global
flags (-v, -q, -o, --json, …), space takes it
itself: space ssh dev -o ServerAliveInterval=30 sets the organization, not an ssh option.
Put -- after the machine name to hand everything to ssh:
space ssh dev -- -v # ssh's debug output
space ssh dev -- -o ServerAliveInterval=30space ssh looks up the machine’s jump host and host key in the portal, writes the host key to
its own ~/.config/agentspaces/known_hosts, and then runs your ssh with strict host
key checking. You never have to accept a machine’s host key by hand. Set AGENTSPACES_SSH to
use another ssh binary.
space ssh also picks the key to offer: the first key in your SSH agent that is registered
on your account, or else the first registered default key in ~/.ssh (id_ed25519,
id_ecdsa, …). It offers only that key, on the jump host as well, so an agent full of
other keys does not slow down the login. Pass -i <key file> to choose the key yourself.
If none of your registered keys is found, ssh offers your keys as usual.
Use plain ssh, scp and rsync
For tools that call ssh themselves (scp, rsync, editors’ remote modes), generate
~/.ssh/config entries for all machines in your organization:
space ssh-config --writeThis writes ~/.config/agentspaces/ssh_config and prints an Include line. Add that line
to the top of ~/.ssh/config (an Include placed after a Host line only applies
inside that block). Then each machine is reachable as <machine name>.<org slug>:
ssh dev.acme
scp ./build.tar.gz dev.acme:/root/
rsync -a ./src/ dev.acme:/root/src/space ssh-config also refreshes the machines’ host keys in ~/.config/agentspaces/known_hosts,
which the generated blocks point at. Run it again after creating or deleting machines, or after
restoring or cloning one. Without --write it prints the blocks, so you can paste them
yourself.
Without the CLI
The SSH tab of the machine’s Manage dialog in the portal (Manage in its menu on the canvas) shows the same Host block and the machine’s known_hosts line.
The bare command is:
ssh -J <ssh endpoint> root@<machine id>for example ssh -J ssh.nl-ams-1.example:2222 root@0b7c6f9e-…. Your region’s SSH endpoint
is on the SSH tab of the machine’s Manage dialog and in space orgs show (the ssh line).
Host keys
Each machine has its own ed25519 host key, generated on its first boot. The portal is the source
of truth for it, and space ssh refreshes it from there before every connection.
- Restoring a checkpoint keeps the machine’s host key: it is still the same machine.
- A machine created from a checkpoint gets a new host key on its first boot, so it never shares a key with the machine it came from.
- Deleting a machine and creating one with the same name gives a new id and a new key.
The jump host’s own key is not published yet, so the first time you connect to a region
your ssh asks you to accept it (trust on first use). Compare it with the fingerprint your
operator gives you if you can.
Warning
TODO: jump host key fingerprints per region, once the API publishes them.
Your own authorized_keys
The keys from your account are given to the machine on every boot and never stored on its disk,
so removing a key from your account takes effect without touching the machine. You can still add
other keys to /root/.ssh/authorized_keys inside the machine; those are ordinary files on its
disk, and a checkpoint restore rolls them back with everything else.