iaroki
To generate public/private pair of keys enter:
ssh-keygen -b 4096 -t rsa -C "username@email"
Next step is to copy key to the remote server:
ssh-copy-id -i .ssh/id_rsa.pub user01@server2.example.com
On remote server is adviceable to edit /etc/ssh/sshd_config
:
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Restart the sshd service:
systemctl restart sshd
And try to login:
ssh server2.example.com
Done!