How to configure password less authentication using ssh
How to configure password less authentication using ssh
=====================================================
Login to node1.
Create a new ssh keygen .Here i have used RSA keygen. If you want you can use DSA
instead of RSA. By default rsa is generated. -t can be
specify to generate any other key like DSA
Test-Node1#ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in //.ssh/id_rsa. (private key)
Your public key has been saved in //.ssh/id_rsa.pub. (public key)
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.
Test-Node1#cd /root
Test-Node1#cd /.ssh
Test-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
Test-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.
Test-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
Test-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 copy the id_rsa.pub key to node2 as authorized_keys where you want to login
without password. By doing this , you will login from node1 to node2 without
password.
In node2, copy the rsa key to node1 as authorized_keys. By doing this , You can
login from node2 to node1 without password.
Below command can also be used on node1 to copy the key to node2
#ssh-copy-id -i /root/.ssh/id_rsa.pub root@node2
root@node2's password: ( we need to provide root password of node2 )
========================
SNGPL Logs