Friday, July 17, 2009

Confiugure ssh in Three Simple Steps

Configure Secure Shell to authenticate users without providing password

This procedure is useful for sftp batch transfers too.
This scenario assumes there are two nodes, named HOSTA and HOSTB.  The same username is assumed to exist on both nodes.

1. Generate public keys on both nodes

Connect to the first node (HOSTA) and execute the following commands to generate RSA and DSA keys for both nodes:
/usr/bin/ssh.-keygen -t rsa
/usr/bin/ssh.-keygen -t dsa

2.  Create the authorized_keys file and transfer it to the other node

Repeat the same command on your second node (HOSTB).  When finished put the generated public keys on the authorized_keys file and ensure the public keys generated from the HOSTA is placed on the .ssh at the HOSTB and vice versa.

cat $HOME/.ssh/id_ras.pub >> authorized_keys
cat $HOME/.ssh/id_das.pub >> authorized_keys
HOSTA$ scp authorized_keys HOSTB:./.ssh
and on HOSTB
HOSTB$ scp authorized_keys HOSTA:./.ssh

Make sure you don't overwrite each others authorized_keys file.

3. Testing

Test both nodes can authenticate the user without requiring it to provide password:

Hope this will help!!!!!!!!!!!!!!!!!!!!!!!!

No comments: