ssh-keygen -t dsawhen prompted to enter a passphrase, simply press the
A pair of files will have been generated:
~/.ssh/id_dsaThe following commands on the source host may be optional:
~/.ssh/id_dsa.pub
chmod 700 ~/.sshCopy the second, generated file over to the target host, providing password when prompted as normally done:
chmod 600 ~/.ssh/id_dsa*
scp -p ~/.ssh/id_dsa.pubOn the target host, append the file to ~/.ssh/authorized_keys:<target_hostname>:
cat ~/id_dsa.pub >> ~/.ssh/authorized_keysThe following commands on the target host may be optional:
chmod 700 ~/.sshNow we are all set to be able to ssh (and scp, etc.) from the source host to the target one without having to provide password. The procedure can be done symmetrically by swapping the source versus target hosts.
chmod 600 ~/.ssh/authorized_keys
rm -f ~/id_dsa.pub
This is particularly useful when there is a large swath of target hosts and a same thing is to be done on them one by one, by using the source/current host as a base.
Notes on hosts:
Source: RHEL/AS/3u3 (kernel: 2.4.21-20.ELsmp #1 SMP)
Target: RHEL/5.2 (kernel: 2.6.18-92.el5 #1 SMP)