RSA key pair generation

RSA keys are used to avoid the login prompt when you try to SSH to the server. Generating RSA keys is very simple.

Please follow the steps given below.

From the server1,

$ ssh-keygen -t rsa

Press key to accept the default file location of /root/.ssh/id_rsa

Change the permission to 755 to the directory “/root/.ssh/id_rsa”

$ chmod 755 /root/.ssh/id_rsa

Now create a file “/root/.ssh/authorized_keys” on the target system.

$ touch /root/.ssh/authorized_keys

From server1, copy the contents of the file “/root/.ssh/id_rsa.pub” to the file “/root/.ssh/authorized_keys2″ on server2. You can do it using the command “scp” as follows.

$ scp /root/.ssh/id_rsa.pub root@server2:/root/.ssh/authorized_keys

That’s all

Now you can connect the server2 from server1 through SSH without typing the password.

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.