How to setup and use SSH to connect with other computers.
SSH is a useful protocol that allows you to connect to servers. You can use it to automate file synchronisation using rsync.
It requires two components, a private and a public key. To set up SSH with a server, you need to upload the public key to the server and configure your computer to check it agains the local, private key.
Generating a keypair
ssh-keygen -t ed25519 -a 100 -f ~/.ssh/keyname
Adding a passphrase is not required, but it's more secure. If you do, make sure to store it in a safe location.
Adding the key to the configuration
Create a config file in the .ssh directory:
touch ~/.ssh/config
Add the following configuration settings to the file:
Host servername
Replace servername with a name that you can remember, change domain.com to the actual domain name as well as username and keyname.
The AddKeysToAgent yes is only necessary if you created a passphrase.
Copying the Public Key to the Server
ssh-copy-id -i ~/.ssh/keyname.pub servername
Now you should be able to access the webserver with
ssh servername
If you created a passphrase you will need to enter it when connecting to the server for the first time.
incoming(1) | cron