Automate a Remote Login Using SSH – Linux
Posted on : 10-15-2009 | By : Cool Geex | In : Linux, Terminal
0

To do just that you need to create SSH Key Pair
1. we need to use ssh-agent to create an SSH key pair.
To do that run this command: ssh-keygen -t rsa
When prompted for a password, choose something long and secure.
After few secondsĀ you should see a message like:
Your identification has been saved in ~/.ssh/id_rsa.
Your public key has been saved in ~.ssh/id_rsa.pub.
Now we need to add the public key (id_rsa.pub) to our web server. You can head in to the web server via FTP and cut and paste the info into ~/.ssh/authorized_keys.
Or The terminal way, execute this line, substituting your login info:
cat ~/.ssh/id_rsa.pub | ssh YourUserName@YourServer.com ‘cat >> .ssh/authorized_keys’
Notes:
1. For some versions of ssh, you may have to use the ~/.ssh/authorized_keys2 file.
2. you can also use dsa instead of rsa.
*** For RSA keys the minimum size is 768 bits and the default is 2048 bits.
*** DSA keys must be exactly 1024 bits as specified by FIPS 186-2.







