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