On the local machine, type the BOLD part. The non-bold part is what you might see as output or prompt.
- Step 1:
% ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (~/.ssh/id_dsa): (just type return)
Enter passphrase (empty for no passphrase): (just type return)
Enter same passphrase again: (just type return)
Your identification has been saved in ~/.ssh/id_dsa
Your public key has been saved in ~/.ssh/id_dsa.pub
The key fingerprint is:
Some really long string
% - Step 2:
Then, paste the content of the local ~/.ssh/id_dsa.pub file into the file ~/.ssh/authorized_keys on the remote host. - RSA instead of DSA
- If you want something strong, you could try
% ssh-keygen -t rsa -b 4096 - Instead of the names id_dsa and id_dsa.pub, it will be id_rsa and id_rsa.pub , etc.
- The rest of the steps are identical.
- If you want something strong, you could try
That’s it!
FAQ:
- Q: I follow the exact steps, but ssh still ask me for my password!
- A: Check your remote .ssh directory. It should have only your own read/write/access permission (octal 700)
% chmod 700 ~/.ssh
Source: http://www.ece.uci.edu/~chou/ssh-key.html