Password less Auth

Password less authentication may required in various setup and we need to configure password less authentication for root user in cluster setup in order to install cluster software on both the machine simultaneously. Here we will see how to configure password less authentication using ssh on Solaris nodes.

Login to node1.
Create a new ssh keygen .Here i have used RSA keygen. If you want you can use DSA instead of RSA.

karri-Node1#ssh-keygen -t rsa
 Generating public/private rsa key pair.
 Enter file in which to save the key (//.ssh/id_rsa):
 Enter passphrase (empty for no passphrase):
 Enter same passphrase again:
 Your identification has been saved in //.ssh/id_rsa.
 Your public key has been saved in //.ssh/id_rsa.pub.
 The key fingerprint is:
 e4:34:90:01:7e:0a:38:45:fa:bb:4d:ef:0c:57:ce:2a root@node1
 Go to the directory where the keys are stored. It will be stored in root’s home directory by default.
karri-Node1#cd /.ssh
 karri-Node1#ls -lrt
 total 5
 -rw------- 1 root root 887 Jul 29 23:03 id_rsa
 -rw-r--r-- 1 root root 220 Jul 29 23:03 id_rsa.pub
karri-Node1#cat /etc/hosts
 "/etc/hosts" [Read only] 6 lines, 88 characters
 #
 # Internet host table
 #
 ::1 localhost
 127.0.0.1 localhost
 192.168.2.5 node1 loghost
 192.168.2.6 node2
 Login to node2 and perform the same what we have did for node1.
karri-Node2#ssh-keygen -t rsa
 Generating public/private rsa key pair.
 Enter file in which to save the key (//.ssh/id_rsa):
 Created directory '//.ssh'.
 Enter passphrase (empty for no passphrase):
 Enter same passphrase again:
 Your identification has been saved in //.ssh/id_rsa.
 Your public key has been saved in //.ssh/id_rsa.pub.
 The key fingerprint is:
 ad:14:b0:83:75:23:fa:c2:96:b6:1c:1d:85:96:b1:77 root@node2
karri-Node2#cat /etc/hosts
 "/etc/hosts" [Read only] 6 lines, 88 characters
 #
 # Internet host table
 #
 ::1 localhost
 127.0.0.1 localhost
 192.168.2.6 node2 loghost
 192.168.2.5 node1

Now i am copying the rsa key to node2 as authorized_keys where you want to login without password. By doing this , i can login from node1 to node2 without password.

karri-Node1#scp -r id_rsa.pub node2:/.ssh/authorized_keys
 The authenticity of host 'node2 (192.168.2.6)' can't be established.
 RSA key fingerprint is 93:cc:1f:07:17:bf:79:34:7e:05:2f:25:28:64:fb:60.
 Are you sure you want to continue connecting (yes/no)? yes
 Warning: Permanently added 'node2,192.168.2.6' (RSA) to the list of known hosts.
 Password:
 id_rsa.pub 100% |*****************************| 220 00:00
 karri-Node1#

In node2,i am copying the rsa key to node1 as authorized_keys.By doing this , i can login from node2 to node1 without password.

karri-Node2#scp -r id_rsa.pub node1:/.ssh/authorized_keys
 The authenticity of host 'node1 (192.168.2.5)' can't be established.
 RSA key fingerprint is 93:cc:1f:07:17:bf:79:34:7e:05:2f:25:28:64:fb:60.
 Are you sure you want to continue connecting (yes/no)? yes
 Warning: Permanently added 'node1,192.168.2.5' (RSA) to the list of known hosts.
 Password:
 id_rsa.pub 100% |*****************************| 220 00:00
 karri-Node2#

Testing the access from node1

karri-Node1#ssh node2
 Last login: Mon Jul 30 00:18:46 2012 from node1
 Oracle Corporation SunOS 5.10 Generic Patch January 2005
 karri-Node2#
 Testing the access from node2

karri-Node2#ssh node1
 Last login: Mon Jul 30 00:05:53 2012 from 192.168.2.2
 Oracle Corporation SunOS 5.10 Generic Patch January 2005
 karri-Node1#

Thank you for reading this article.Please leave a comment if you have any doubt ,i will get back to you as soon as possible.