Okay, say you have a server, you have to ssh to this server … say 20 times a day?
It gets irritating having to login and type your password repeatedly. Not to mention it can be insecure if anyone is sniffing the network.
So on your desktop machine you want to create some keys. This can be done with the following command
ssh-keygen -t dsa
At the prompts just press enter for all the defaults.
Now you should have a file in .ssh/id_dsa.pub , this file has to go to the server. You can do this with this command
cat .ssh/id_dsa.pub | ssh username@servername "cat - >>.ssh/authorized_keys2"
All going well, this should exit cleanly. Test it by ssh’ing again to the server normally, if all goes well it shouldn’t prompt but just drop you into your remote shell.
If this fails make sure your servers sshd_config has the following line
PubkeyAuthentication yes
Last-Modified: 2007-03-07 19:38:50