Generating SSH Keys
This is a quick little how to for getting ssh keys working.
First you will need to generate the keys. The default is 2048 bytes which should be sufficient. You can specify a different value by using the -b option. The -t option is so that you create an SSH2 key and not an SSH1 key. I like to use a passphrase for some extra security; however, you can leave the passphrase blank if you do not want to use one. Not recommended though.
Use the following command.
ssh-keygen -t rsa
gerard@despondency:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/gerard/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/gerard/.ssh/id_rsa.
Your public key has been saved in /home/gerard/.ssh/id_rsa.pub.
The key fingerprint is:
8a:28:a4:4e:d6:a1:7c:9b:38:d4:1c:19:82:a9:ef:ca gerard@despondency
This will create two files id_rsa and id_rsa.pub unless you have specified a different file name. The file with the .pub extension is your public key which you should put on the client systems which I will explain later. The one without the .pub extension is your private key which you should guard with your life!
Now you will need to distribute the public keys to the destination systems. The easiest way is to use ssh-copy-id . You will use a command similar to the following.
ssh-copy-id -i .ssh/id_rsa.pub gerard@192.168.xxx.xxx
Using this command you will need to use -i then the name of the file which contains the public key you would like to distribute. Then, the destination is where you would like to SCP the public key to.
gerard@despondency:~$ ssh-copy-id -i .ssh/id_rsa.pub root@192.168.xxx.xxx
15
root@192.168.30.45’s password:
Now try logging into the machine, with “ssh ‘root@192.168.xxx.xxx’”, and check in:
.ssh/authorized_keysto make sure we haven’t added extra keys that you weren’t expecting.
July 21st, 2010 at 4:15 am
Buy:Maxaman.Cialis Soft Tabs.Levitra.Viagra Professional.Propecia.Tramadol.Zithromax.Cialis Professional.VPXL.Viagra Soft Tabs.Viagra Super Active+.Soma.Super Active ED Pack.Viagra.Cialis Super Active+.Viagra Super Force.Cialis….