How to setup an SSH shared key to allow automatic login from your personal workstation to other servers/workstations.
Posted On 2008-01-17
by Dr. Zee
How to setup an SSH shared key to allow automatic login from your personal workstation to other servers/workstations.
Note: It is important to understand the pros and cons of using a shared key without a password. While it can protect against key loggers it can also allow easy access for anyone who has physical access to your workstation. Now days many people use laptops which increases the risk of compromise considerably. Your command history and files on the drive can give the bad guys easy access to remote hosts.
Generate the key on your personal workstation. When prompted for a password hit return twice to leave it blank.
ssh-keygen -t dsa -f ~/.ssh/id_dsa
Copy the key over to the desired host.
scp ~/.ssh/id_dsa.pub host:~/
Replace host with the hostname or IP of the destination.
SSH into the host, dump the key into the authorized_keys file and remove the original key file.
cat id_dsa.pub >> ~/.ssh/authorized_keys
rm id_dsa.pub
Note: Make sure your .ssh directory on all the machines are set to only allow the owner to read and write to the directory. Issue the following command to make sure.
chmod -R 700 ~/.ssh
Now try to SSH into the host again. It should log you right in.
by David Miller