Monday, March 06, 2006

SSH Without a Password

The steps assume that a DSA key is being used. To use a RSA key substitute 'rsa' for 'dsa'. The steps assume that you are using a Bourne-like shell (sh, ksh or bash) Some of this information came from: http://www.der-keiler.de/Mailing-Lists/securityfocus/Secure_Shell/2002-12/0083.html

For our testing purpose, we define two servers and one client
SSH client: cse-wang-server
SSH server: cse-wang05b cse-wang11

Steps:1. On the client run the following commands:
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''
cd $HOME/.ssh/
mv id_dsa.pub id_dsa.pub-`hostname -s`
for server in cse-wang05b.unl.edu cse-wang11.unl.edu ; do
echo "Host ${server}" >> config
echo " IdentityFile ~/.ssh/id_dsa" >> config
scp id_dsa.pub-`hostname -s` ${server}:./.ssh/
done
2.On the server run the following commands:
cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys
cd $HOME/.ssh/
for client in cse-wang-server ; do
cat id_dsa.pub-${client} >> authorized_keys2
done
chmod 0600 authorized_keys2
3.On the client, test the ssh connectionssh cse-wang05b.unl.edu

No comments: