Enable SSH login by public key

Generate private key on your working machine

ssh-keygen -t rsa -b 4096 -C "your_email@domain.com"

And now copy public key to server by

ssh-copy-id user@server

Enter server password and done

Disable server login by password by update below values

ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
sudo systemctl reload ssh

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: