SSH Without a Password
Generate a public/private key pair
ssh-keygen -t dsa -f .ssh/id_dsa
- -t tells the type of encryption
- -f tells where to store the public/private key pairs
When the system prompts for a password, leave it blank, just pressing <enter> In the .ssh directory, and you will find two new files: id_dsa and id_dsa.pub.
Copy the public key file to the target system
id_dsa.pub is the public part. Simply copy the public key to the target system.
scp .ssh/id_dsa.pub user@remote:~/.ssh/id_dsa.pub
This time you will need to enter the password, as the key has not been installed.
Log into the server machine and setup the .ssh directory on the server side by adding the client's public key to the known public keys collection on the server. You can have multiple private keys in the authorized keys file.
ssh user@remote cat .ssh/id_dsa.pub >> .ssh/authorized_keys2 chmod 600 .ssh/authorized_keys2 rm .ssh/id_dsa.pub