With a little side of applesauce...

Thursday, February 1, 2007

ssh authentication through public/private keypairs

You can generate public/private keypairs to help aid in managing large numbers of machines. (This saves you from having to enter your password every time you login to a machine).

1. Generate a RSA key:

ssh-keygen -t rsa

2. cd into your .ssh directory and run the following command:

cat .ssh/id_rsa.pub | ssh user@remotehost 'cat - >> ~/.ssh/authorized_keys2'

If it complains about a missing .ssh directory on the remotehost, ssh to the machine (remotehost), and then ssh to another machine from remotehost. (This is a quick way to create that directory). Then rerun step 2 above.


No comments: