lunedì 23 gennaio 2012

SSH automatic authentication without inserting password

We start with 2 ubuntu box's 10.04 , one is the server (SERVER_SSH) the other is the client (CLIENT_SSH).
Both box's have not .ssh folder in their home directory.

On the CLIENT_SSH:
make .ssh folder in the home directory

user@CLIENT_SSH:~$ mkdir ~/.ssh

generating id_rsa.pub public key

user@CLIENT_SSH:~$ cd ~/.ssh
user@CLIENT_SSH:~$ ssh-keygen -t rsa

copying content of id_rsa.pub in the authorized_keys file using cat command (can do it also by hand copying and pasting)

user@CLIENT_SSH:~$ cd ~/.ssh
user@CLIENT_SSH:~$ cat ~/.ssh/id_rsa.pub >> authorized_keys

add the ssh client

user@CLIENT_SSH:~$ssh-add




On the SERVER_SSH:

make sure the /etc/ssh/sshd_config file allow this kind of authentication

otheruser@SERVER_SSH:~$ vi /etc/ssh/sshd_config

the following parameters must be set on 'yes'

RSAAuthentication yes
PubkeyAuthentication yes


make .ssh folder in the home directory

otheruser@SERVER_SSH:~$ mkdir ~/.ssh

copying the client authorized_keys file to the server (-P 1022 its only for me since the ssh service is listening on this port, otherwise put 22 here)

restarting ssh server

otheruser@SERVER_SSH:~$ /etc/init.d/ssh restart

Now, should be possible authentication without inserting password at prompt.

Nessun commento:

Posta un commento