github gitlab twitter mastodon linkedin instagram 500px email
Passwordless SSH key-based authentication
Mar 20, 2017
One minute read

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!



Tags: linux ssh

Back to posts