Using SSH keys is not only a good practice it can be a time saving practice especially if you have lots of machines in your environment. Just think if you have five machines, that is five times you have to traditionally authenticate. I am going to assume that these commands are cross platform for Linux, if they are not please look at your distributions man pages as the methodology should be the same for OpenSSH no matter what platform it is on.
First we begin by generating your local machines key files by using the command “ssh-keygen -t dsa”. What this command does is generate a unique key for you using the DSA algorithm. You will be prompted to place the keyfile in a location such as “.ssh/id_dsa”. This is just fine, if you want to generate a different key specify file just supply a different file path. After that prompt there will be another prompt for a passphrase. Your passphrase is not your actual password, it is a passphrase to unlock the key that is stored on the server. Make this secure, add one number and one character from !@#$%^&*()_+ if you want. Once the key has been generated you can check the file manually do “cat /path/to/keyfile” usually this is “/home/yourusername/.ssh/id_dsa.pub”. This file can be copied to the server a couple of ways.
First is using the ssh-copy-id command and this takes the parameter “-i” and then the path to the file so for example “ssh-copy-id -i ~/.ssh/id_dsa foobar@foobaz.net” will copy the key you just created to the server of choice as denoted by foobar@foobaz.net. You will have to authenticate manually to do this but this should be the last time for a long time. Now the alternative way to get your key on the server that you copy the string in the file id_dsa.pub and manually put that in a file called authorized_keys on the remote machine in the folder “.ssh”.