Generating Public Key
Backup your ~/.ssh
Use ssh-keygen to generate you .ssh keys
ssh-keygen -t rsa Generating public/private dsa key pair. Enter file in which to save the key (/Users/username/.ssh/id_dsa): [RETURN] Enter passphrase (empty for no passphrase): [Enter a secure passphrase then RETURN] Enter same passphrase again: [Repeat the same secure passphrase then RETURN] Your identification has been saved in /Users/username/.ssh/id_dsa.
Your public key has been saved in /Users/username/.ssh/id_dsa.pub.
Similarly, generate the dsa key
ssh-keygen -t dsa
Once the SSH key has been generated, you can safely share public key. Just include the contents of the ~/.ssh/id_dsa.pub.
Both DSA and RSA are digital signature algorithms, DSA is faster for signature generation but slower for validation.
SSH to any machine without prompting for password.
Login into that machine with your username
ssh username@remotehost username@remotehost's password: ******** remotehost:~ username $ mkdir .ssh remotehost:~ username $ exitFrom your local machine where ssh key was generated -
scp -p ~/.ssh/authorized_keys username@remotehost:~/.ssh/ username@remotehost's password: ******** authorized_keys
Authorize localhost access without password: [ssh user@localhost]
cd ~/.ssh cp id_dsa.pub authorized_keys