Tuesday, January 19, 2016

How To Configure SSH between two nodes :

How To Configure SSH between two nodes :

[oracle@rac1 ~]$ mkdir .ssh
[oracle@rac1 ~]$ chmod 700 .ssh
[oracle@rac1 ~]$ cd .ssh

[oracle@rac1 .ssh]$ /usr/bin/ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
e3:a6:e2:ab:ff:7f:07:85:25:24:c3:21:03:59:50:e4 oracle@rac1.sangramkeshari.net
[oracle@rac1 .ssh]$ /usr/bin/ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
82:70:af:f0:36:de:27:eb:3f:a6:c8:a2:cd:8c:ec:f1 oracle@rac1.sangramkeshari.net
[oracle@rac1 .ssh]$ cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
[oracle@rac1 .ssh]$ cat /home/oracle/.ssh/id_dsa.pub >> authorized_keys

[oracle@rac2 ~]$ mkdir .ssh

[oracle@rac1 .ssh]$ scp authorized_keys rac2:/home/oracle/.ssh/
The authenticity of host ‘rac2 (192.168.33.32)’ can’t be established.
RSA key fingerprint is d7:3b:e3:e3:a3:1a:74:2d:7d:75:d1:d3:bd:da:5f:99.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac2,192.168.33.32’ (RSA) to the list of known hosts.
oracle@rac2’s password:
authorized_keys 100% 1044 1.0KB/s 00:00
[oracle@rac1 .ssh]$

[oracle@rac2 ~]$ cd .ssh
[oracle@rac2 .ssh]$ ls -ltra
total 12
drwx—— 5 oracle oinstall 4096 Apr 27 03:56 ..
-rw-r–r– 1 oracle oinstall 1044 Apr 27 03:58 authorized_keys
drwxr-xr-x 2 oracle oinstall 4096 Apr 27 03:58 .

[oracle@rac2 .ssh]$ /usr/bin/ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
ba:d9:af:1b:a9:56:3d:81:a8:e1:76:59:96:72:42:9d oracle@rac2.sangramkeshari.net
[oracle@rac2 .ssh]$ /usr/bin/ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
43:db:f4:c1:0c:f5:9e:0f:53:53:eb:e5:a5:af:0e:ca oracle@rac2.sangramkeshari.net
[oracle@rac2 .ssh]$ cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
[oracle@rac2 .ssh]$ cat /home/oracle/.ssh/id_dsa.pub >> authorized_keys
[oracle@rac2 .ssh]$

[oracle@rac2 .ssh]$ scp authorized_keys rac1:/home/oracle/.ssh/
The authenticity of host ‘rac1 (192.168.33.31)’ can’t be established.
RSA key fingerprint is d7:3b:e3:e3:a3:1a:74:2d:7d:75:d1:d3:bd:da:5f:99.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac1,192.168.33.31’ (RSA) to the list of known hosts.
oracle@rac1’s password:
authorized_keys 100% 2088 2.0KB/s 00:00
[oracle@rac2 .ssh]$

ssh rac1 date
ssh rac2 date

ssh rac1.sangramkeshari.net date
ssh rac2.sangramkeshari.net date

ssh rac1-priv.sangramkeshari.net date
ssh rac2-priv.sangramkeshari.net date

–When Promted say Yes

[oracle@rac1 .ssh]$
[oracle@rac1 .ssh]$ ssh rac2
[oracle@rac2 ~]$ exit
logout
Connection to rac2 closed.

No comments:

Post a Comment