View Full Version : [TUT] Fast Logins with ssh keys

12-06-2013, 12:15 PM
If you have to manage multiply servers via SSH is really annoying to type same password over and over again. The public key exchange can be used for a secure alternative of typing password on each login.
Here is quick tutorial how to do it:

1) First you need to generate private/public key, so enter this command:

ssh-keygen -t rsa

The script will ask you to enter a passphrase two times and it will generate two files: ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub (where "~" is a shortcut to user's home directory).

2) Now to use this keypair on a server, try this run this command:

$ ssh server "mkdir .ssh; chmod 0700 .ssh"
$ scp .ssh/id_rsa.pub server:.ssh/authorized_keys

Now you just need to ssh the server. It won't require pass for most of the operations between this two computers.

12-06-2013, 07:16 PM
If you work with multiple servers, ssh keys are the best to use. Even when you do the extra tweaks with hostnames to just do ": ssh box1" and "ssh box2" to switch around.
When I had a set of Linux servers, I just set them up so I could do "goto server1, goto server2, goto server3" between them, was a huge time saver in the end.

Thanks for sharing the how-to