Setup

SSH config

Not checked yet

If you connect to other computers with ssh, a config file saves you from remembering addresses, user names and key files. Skip this page if you do not use SSH.

The file is ~/.ssh/config. Create it if it does not exist:

mkdir -p ~/.ssh && chmod 700 ~/.ssh
touch ~/.ssh/config && chmod 600 ~/.ssh/config

Then add an entry for each machine:

Host web
    HostName 203.0.113.10
    User deploy
    IdentityFile ~/.ssh/id_ed25519

Host *
    AddKeysToAgent yes
    UseKeychain yes

Now ssh web does what ssh -i ~/.ssh/id_ed25519 deploy@203.0.113.10 did. The same short name works in scp, rsync, and in apps that read this file.

The Host * block applies to every connection. UseKeychain stores the passphrase of your key in the macOS Keychain, so you type it once and not on every connection.

Moving to a new Mac

Your keys live in ~/.ssh/ next to the config. They are not part of iCloud, so copy the folder across yourself, and keep the private keys (the files without .pub) off any shared or unencrypted disk.