Wiki‎ > ‎

Passwordless SSH

posted Feb 8, 2011, 2:33 PM by Danny Xu   [ updated Jul 15, 2016, 12:57 PM ]

Set Up:
1. Run ssh-keygen -t dsa
2. Choose a spot to save the file, default location is the best.
3. Choose a password, or leave blank for no password
4. Retype password, or leave blank.

Adding a Host:
1. Start the agent and connect the termal with ssh-add as described below.
2. Call ssh-copy-id <host name>
3. Enter the password for that host
4. Test it by calling ssh <host name>, if you log in with out being prompted by a password everything worked. Otherwise check the .ssh/autorized_keys file on the remote machine.

1. Start the ssh key daemon by calling eval `ssh-agent` (I usually alias this step. alias ssh-ag='eval `ssh-agent`') Note the PID number of the agent printed in the terminal.
2. In the termial or script you wish to have passwordless ssh type ssh-add. If you have a password you will be prompted for it once while you have the terminal open.
3. Use ssh as normally. Adding -A will forward this keyless option with later ssh calls.

cd $HOME
ssh-keygen -t rsa1 -N "" -f $HOME/.ssh/identity
ssh-keygen -t rsa -N "" -f $HOME/.ssh/id_rsa
ssh-keygen -t dsa -N "" -f $HOME/.ssh/id_dsa
cd .ssh
touch authorized_keys authorized_keys2
cat >> authorized_keys
cat >> authorized_keys2
chmod 640 authorized_keys authorized_keys2


Make sure that the authorized key to points to the id_dsa file like so

******== /garlic/user/<user>/.ssh/id_dsa