# first generate an RSA key pair on the client machine, fred. This will create some new files under ~/.ssh/
ssh-keygen -t rsa
# now copy the public key file up to the host machine (barney) and put it into the .ssh folder in
# the user's home directory at the other end.
scp ~/.ssh/id_rsa.pub barney:~/.
then log into the remote machine in the usual way and move the new key file into place
# create the .ssh directory if it doesn't already exist
# copy the public key into ~/.ssh/authorized_keys
cat id_rsa.pub >> ~/.ssh/authorized_keys
# create a symbolic link to another file called authorized_keys2 to enable these keys for ssh2
# ln -s authorized_keys authorized_keys2
That's all that needs to be done. In fact this id_rsa.pub file can be appended to the authorized_keys file in any user's .ssh directory on any machine and the logins from that point will be totall seamless. This is very useful for automated scripts which use ssh or scp.