mercredi 7 décembre 2016

SSH with RSA keys without password

First generate a public key with the command:
ssh-keygen

then there are two files:

.ssh/id_rsa (your private key)
.ssh/id_rsa.pub (your public key)

Do a:
From your home directory:

chmod og-r -R .ssh

Check the rights of the folder .ssh
it should be xrw------

On the target server

create a folder .ssh
create a file named authorized_keys

In that file paste the content of the file id_rsa.pub

chmod og-r -R .ssh 
 On most of the configuration this will be enougth, but sometimes you could hae some limitation in the file

vi /etc/security/access.conf

You can allow a specific user to access your server by anabling

+ : youruser ALL


Also you must check that there is no restrictions linked to the domain. 

vi /etc/hosts.allow

You should check that there is no restriction on the 
sshd: domain