In the past I came across some tutorials that describe how to achieve a ssh password-less setup, but some are sadly wrong.
Let's start over again, and check every step:
- FROM CLIENT - Generate key:
ssh-keygen -t rsa
Public and private key (id_rsa.pubandid_rsa) will be automatically stored in the~/.ssh/directory.
Setup will be easier if you use an empty passphrase. If you are not willing to do that, then still follow this guide, but also check the bullet point below. - FROM CLIENT - Copy public key to server :
ssh-copy-id user@server
Client public key will be copied to server's location~/.ssh/authorized_keys. - FROM CLIENT - Connect to server:
ssh user@server
Now, if it's still not working after the described 3 steps, lets try the following:
- Check
~/.sshfolder permissions in client and server machine. - Check
/etc/ssh/sshd_configin the server to ensure thatRSAAuthentication,PubkeyAuthenticationandUsePAMoptions aren't disabled, they can be enabled by default withyes. - If you entered a passphrase while generating your client key, then you may try
ssh-agent&ssh-addto achieve password-less connections in your session. - Check the contents of
/var/log/auth.logon the server to find the issue why key authentication is skipped at all.