Published by Niels on 03 Dec 2005
Learning all the time
As mentioned in an earlier post I was looking for a mechanism to get remote information and take actions based on that information without having to give my password multiple times. Recently I found at that apparently I am a SSH newbie, because it is very easy to setup SSH in such a way that you never have to provide a password ever again when working from a machine that is known to the remote system.
On your local system do the following:
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''
Now copy the resulting file $HOME/.ssh/id_dsa.pub to the remote server you want password-less access to and log in to the remote system (using SSH of course). On the remote system take the following actions:
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
cat id_dsa.pub >> $HOME/.ssh/authorized_keys2
chmod 0600 $HOME/.ssh/authorized_keys2
rm -f id_dsa.pub
If you want access from multiple machines to the remote system just repeat the ssh-keygen, cat and rm commands from the system you want use to connect to the remote server.