Sunday, August 25, 2013

Connecting two servers using SSH public keys.


Creating shake hand between servers using SSH public keys.


 




Use the below method to generate Public keys:

On source host server:

Goto to user directory

    cd ~
    mkdir .ssh
    chmod 700 .ssh
    cd .ssh

Execute the below command
 
/usr/local/bin/ssh-keygen -t rsa -b 1024(or) ssh-keygen -t rsa -b 1024

cat id_rsa.pub

 copy contents of id_rsa.pub (file)


On destination host server:

Goto to user directory 

    cd ~
    mkdir .ssh
    chmod 700 .ssh
    cd .ssh
    vi authorized_keys

Paste contents of id_rsa.pub  into authorized keys (to which ever connecting server)
 
chmod 600 authorized_keys --(don’t miss this permission, this should be and must be 600)

After completion of above steps execute below command from destination host:

ssh xyz.alpha.com

Till Next time..:)






No comments: