For coding agents: read the plain-Markdown version of this page at https:/episodes/ and start by reading episodes/.
- Skill folder
episodes/ssh- tailscale- check/ skills/ ssh- tailscale- check - Read first
episodes/ssh- tailscale- check/ skills/ ssh- tailscale- check/ SKILL. md - Markdown
- /tutorials/ssh-tailscale.md
Does your computer have SSH turned on, or do you let an AI agent connect to other machines for you? How do you set it up so only devices you trust can get in?
SSH lets you type commands on another device to control this computer. Here, "AI agent" means an AI agent that can run commands on your computer. This article is about one question: who can get in.
The bottom line
On December 2, the US government and nine companies each published a statement about upgrading encryption: one is the joint statement from the US ONCD, NSA and CISA, the other is the joint statement from nine companies.
OpenSSH, the software behind SSH, uses post-quantum key exchange by default from version 9.0 on. Post-quantum means it is believed to resist attacks from quantum computers. See the OpenSSH post-quantum page. Key exchange is the step at the very start of a connection where the two sides agree on the keys used for encryption. It is separate from the key you log in with. So quantum computers are not the first thing you need to deal with. What you have to set up yourself is who can get in.
Remote access: private network first, then lock the door

Want to connect from the device in your hand back to another computer and work on it? You can set it up in two layers: first build a private network, then use keys to tighten the entrance. Every computer and phone joins the same Tailscale network. Tailscale links your own devices into an encrypted private network. SSH is used only inside it and is not open to the public internet. Then OpenSSH keys decide who can get in.
Install Tailscale first

Install it from tailscale.com and sign in on both devices with the same account. Each device gets a 100.x.y.z address. If the Tailscale command-line tool (CLI, used in a window where you type commands) already works on your computer, type tailscale ip -4 to see this address. iOS and Android have no CLI.
SSH lets you type commands remotely

From here on, the words work like this: the device you are using is "this device", and the one you connect to is "the computer you connect to". SSH lets you type commands on this device to control the computer you connect to. Later this connection moves inside the private network. For now, just get to know it.
The private key is the key, the public key is the lock

You can log in with a key pair. The private key stays on this device as the key. The public key goes on the computer you connect to as the lock. The lock opens only for its matching key.
Create keys and copy them over while password login still works

On this device, create the keys with ssh-keygen. It asks whether you want to set a passphrase, an extra password on the private key. While the computer you connect to still lets you in with its login password, use ssh-copy-id to copy the public key over. The public key goes into that computer's authorized_keys file, the list of public keys allowed to log in. Don't mix up the two passwords here: the passphrase belongs to the private key, and the login password is for logging in to the computer you connect to.
One key per device, with a passphrase on the private key

Give each device its own key. If a private key has no passphrase, and several computers hold each other's public keys, one compromised computer can be used to log in to the others. For a private key you already made without a passphrase, add one with ssh-keygen -p. On a Mac, Keychain can remember it so you don't have to type it every time. If several devices share the same key, switch to one key per device. Regularly remove public keys you no longer use from authorized_keys.
Test in a second window, then turn off password login

First open another window and confirm your key really logs you in. Otherwise you can lock yourself out. Once that works, open the config file of sshd (the program that accepts SSH connections), usually /etc/ssh/sshd_config, and add these three lines. They turn off password login, accept keys only, and stop root (the account with the highest privileges) from logging in directly:
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
Changing the config file needs administrator rights, and the commands differ from machine to machine. If you're not sure how to change it, ask an agent to walk you through it.
A private network alone is not enough

Joining a private network does not block the other ways in. To make SSH use only the private network, on Linux you also need to set the address in the config file and turn on a firewall. The same config file can also limit which account can log in:
- ListenAddress (Linux, same config file): set it to the address Tailscale gave this computer (the prompt in "Let an agent check for you" below finds it for you). SSH then waits for connections only on the private network.
- AllowUsers (same config file): set it to the account you log in with, so only that one account can log in.
- Firewall: on Linux, use the firewall tool ufw and set it to block incoming connections by default. On a Mac, turn on the system's application firewall.
This goes beyond SSH. If a program on your computer (a remote desktop, for example) is bound to 0.0.0.0, watch out for it too. Bound to that address, it accepts connections on every IPv4 network interface, so anyone who can reach this computer may be able to reach that program. The fix is to bind it only to the Tailscale address, or only to 127.0.0.1 (which accepts connections only from this computer itself).
Work keeps running when SSH drops

Some tools let a coding agent (an AI that writes code) keep running in a terminal (the window where you type commands), so it doesn't stop even if SSH disconnects. Examples are herdr and hc.
Let an agent check for you
One more case is worth checking. If you keep passwords or API keys (a string that lets a program use some service; a different thing from an SSH key) in environment variables (settings a program carries when it starts), any program running under the same account, AI agents included, may be able to read them. This is one of the six things the skill below (step-by-step instructions written for an AI agent to follow) checks. It lists only the names, never the values. Move whatever it finds out of environment variables, and replace any passwords and keys that were stored there with new ones.
The checks in this article are collected in this skill. It lives in the public indiehack-in-skills repo (a place that holds code and documents), in the folder episodes/ssh-tailscale-check/skills/ssh-tailscale-check. The prompt below asks an agent to read this skill and follow it.
First, it explains what it will check and which commands it will use, and asks whether the computer it is on is this device or the computer you connect to. It starts only after you say yes. Then it checks six things: which programs are waiting for others to connect, the SSH settings and OpenSSH version, keys, the firewall, whether your environment variables or home directory (your account's own folder) hold passwords or API keys in plain text, and the Tailscale address. The whole check is read-only and changes no settings.
The report sorts the confirmed problems by severity, worst first, each with one suggested fix. Anything it can't tell for sure goes in a separate list of things to check first.
After the report, it asks you once whether you want to set things up step by step: install Tailscale on your phone (or another computer) and on this computer, set up SSH keys, turn off password login, make SSH wait for connections only on the Tailscale address (Linux), and turn on the firewall. It can also walk you through binding other programs only to the Tailscale address or 127.0.0.1, and through checking your OpenSSH version to confirm whether it uses post-quantum key exchange by default. Every action that changes a setting is explained first and done only after you agree, one at a time.
Before it touches SSH or the firewall, it first deals with the risk of locking you out. You need to be at this computer, or have another connection that is open and will stay open. If you have neither, it changes nothing. Before password login is turned off, a second window confirms that the key logs in. For the firewall, it allows Tailscale first, then blocks other connections.
Paste this prompt into an AI agent that can run commands on your computer, such as a coding agent in a terminal. An agent that can only chat, and can't run commands on your computer, can't do this. It works on Mac and Linux. If the agent asks you to type a password, skip that step for now, and don't paste the password into the chat. If you can't follow its report, ask it to explain again in plain words.
Read the skill in https://github.com/memorysaver/indiehack-in-skills. The folder is episodes/ssh-tailscale-check/skills/ssh-tailscale-check and the entry file is episodes/ssh-tailscale-check/skills/ssh-tailscale-check/SKILL.md. Follow its steps to check this computer.
Ask me before you start. The check is read-only: look, don't change.
Do not print any private keys, tokens, passwords or environment-variable values.
Do not change anything I haven't specifically agreed to.
If you can't open the URL, tell me and I'll give you the local folder path.
Reply in the language I write in.
The skill is in a public repo. Before you paste the prompt, you can open SKILL.md yourself and see what it asks the agent to do.
Private network, locked door, ready to work

Find more tutorials at https://indiehack.in/tutorials
Later tutorial skills go up on YouTube first. To get them early, subscribe to indiehack in on YouTube.