Ssh private key authentication
Setup your Linux box to automatically login via ssh to servers you manange regularly.
First I setup some hosts.
sudo nano /etc/hosts
Add your hosts in the following format
1.2.3.4 example01
1.2.3.5 example02
Now we need to generate our local private and public key pair. If you have already done this before, you can skip this step.
ssh-keygen -t rsa
Enter your password, or leave it blank if you know what your doing.
Now for each host you want to set up, you will need to make sure it has tried to connect out to another host via ssh.
Login
ssh user@example01
Once your in to the destination host, ssh out
ssh user@192.168.0.5
Answer yes when it asks you to check the authenticity of the host.
Now you can cancel that, and logout by pressing ctrl + c then ctrl + d.
Now we install our public key on the host.
ssh user@example01 "umask 077; cat >> .ssh/authorized_keys" < ~/.ssh/id_rsa.pub
When we go to login now, you will just need your keyring password (which can be blank). The ssh system will authenticate your local private key against the public key on the remote host.







