Generate a key with the following command. If you are trying to setup passwordless authentication, then do not enter in a password
ssh-keygen
or if you want to use DSA,
ssh-keygen -t dsa
Example:
[root@localhost ~]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: ef:f2:34:e5:12:ac:ab:1b:67:9f:ff:00:12:2d:cd:16 root@localhost
Upload public key to server. Note: you will need to enter in your Password so ssh-copy-id can upload the key, after that you should not need to enter in a password.
ssh-copy-id root@remote-server
Now login to the remote server.
ssh root@remote-server