Using ssh keys to access remote hosts

There are 2 parts to getting password-less, key-based ssh login to work. The first is to generate ssh keys for the user you are going to be accessing the remote host from i.e. your local machine. You then copy the public key of this local user to the remote user you want to login to the remote machine as. These are the steps to take:



1. Generate a public key pair on the local machine:
$ ssh-keygen -t ed25519
This will generate a couple of files in ~/.ssh. You can/should skip this step if this has already been done.



2. Use the ssh-copy-id script to copy the local public key to the remote user:
$ ssh-copy-id -p 3000 -i ~/.ssh/id_ed25519.pub user@host
Make sure you just copy the .pub file. The -p 3000 is only necessary if you are using a non-standard ssh port.



3. Then try logging into the remote machine - you shouldn't be asked for a password! 


BTW, you have several types of public key algorithms for authentication keys: rsa, dsa, ecdsa, ed25519