The following steps describes how you generate a rsa key pair for public key authentication. You need access to the client and the server system.
Creating default directory for the user keys.
Generating key pair.
ssh-keygen -f ~/.ssh/id_rsa -t rsa
Change mode of created folder and files otherwise ssh wouldn't use it.
chmod -R 700 ~/.ssh
Copy the generated id_rsa.pub to server. E.g.:
ssh-copy-id ~/.ssh/id_rsa.pub email@example.com:
Now your systems are ready to use public key authentication.