ssh config Link to heading
Host vps
HostName 123.45.678.9
User root
IdentityFile ~/.ssh/id_vps #
AddKeysToAgent yes # automatically adds the key to the running agent
UseKeychain yes # stores the passphrase in the macOS Keychain
ServerAliveInterval 60 # send keep-alive signal every 60 s (disabled by default)
Show the settings for a host
ssh -G vps
ssh-keygen Link to heading
Generating new key pair Link to heading
# ed25519 more secure elliptic curve
# -C: allows to give a comment to identify key
ssh-keygen -t ed25519 -C "<comment>"
Removing known host entries Link to heading
ssh-keygen -f ~/.ssh/known_hosts -R 123.45.678.9
Copy public key to server Link to heading
ssh-copy-id -i <public key> <user>@<ip_address>
# e.g. ssh-copy-id -i ~/.ssh/id_vps.pub user@123.45.678.9
Checking the passphrase for a private key Link to heading
ssh-keygen -y -f /path/to/your/private_key
ssh agent Link to heading
# load key in agent
ssh-add /path/to/your/private_key
# check keys loaded in the agent
ssh-add -l
scp Link to heading
scp username@source:/location/to/file username@destination:/where/to/put