ssh user@server.example.comConnect to a server.
When to use it
Use ssh to work on remote servers, to reach other Macs with Remote Login on, to authenticate to Git hosts, and to tunnel a port securely.
Steps
Connect
The first time, ssh asks you to confirm the server's key fingerprint and saves it in ~/.ssh/known_hosts.ssh jane@203.0.113.10Create a key
Ed25519 keys are short and strong. Set a passphrase.ssh-keygen -t ed25519 -C "jane@example.com"Install the public key on the server
ssh-copy-id appends ~/.ssh/id_ed25519.pub to the server's authorized_keys.ssh-copy-id jane@203.0.113.10Keep the passphrase in the macOS keychain
Add the key once; macOS remembers the passphrase.ssh-add --apple-use-keychain ~/.ssh/id_ed25519Save hosts in ~/.ssh/config
Thenssh webis enough. Put this in ~/.ssh/config: Host web, HostName 203.0.113.10, User jane, IdentityFile ~/.ssh/id_ed25519, and under Host * add AddKeysToAgent yes and UseKeychain yes.Forward a port
-L forwards a local port to a service reachable from the server, such as a database bound to the server's localhost.ssh -L 5433:localhost:5432 web
Output explained
On first connection:
The authenticity of host '203.0.113.10 (203.0.113.10)' can't be established.
ED25519 key fingerprint is SHA256:…
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Compare the fingerprint with what the server's admin gives you before answering yes. If ssh later shows REMOTE HOST IDENTIFICATION HAS CHANGED, the server's key changed: expected after a reinstall, suspicious otherwise. Remove the old entry with ssh-keygen -R 203.0.113.10 only once you know why.
Options and variations
| Flag | Meaning | Example |
|---|---|---|
| -p PORT | Connect to another port | ssh -p 2222 jane@host |
| -i KEY | Use a specific key | ssh -i ~/.ssh/work_ed25519 host |
| -L L:HOST:R | Local port forward | ssh -L 8080:localhost:80 host |
| -D PORT | SOCKS proxy through the server | ssh -D 1080 host |
| -J JUMP | Connect via a jump host | ssh -J bastion internal |
| -v | Verbose, for debugging | ssh -v host |
Common errors
| Error | Cause | Fix |
|---|---|---|
| Permission denied (publickey) | Key not accepted | See the dedicated guide: load the key, check authorized_keys. |
| Connection refused | No SSH server listening | Enable Remote Login or start sshd. |
| Connection timed out | Firewall or wrong address | Check the IP and that port 22 is allowed. |
Do it in the app
LightAtom's connections view shows each SSH session from your Mac and the data it moves, including tunnels.
Frequently asked questions
How do I SSH from a Mac?
Open Terminal and run ssh user@host. macOS includes OpenSSH (9.9 on macOS 15), so nothing needs installing.
Where are SSH keys stored on a Mac?
In ~/.ssh: the private key (id_ed25519) and public key (id_ed25519.pub). The config file and known_hosts live there too.
How do I stop typing my SSH passphrase on a Mac?
Run ssh-add --apple-use-keychain ~/.ssh/id_ed25519 once and add UseKeychain yes and AddKeysToAgent yes to ~/.ssh/config.