SSH connectivity configuration provides connection among nodes without using password. If you configure ssh, nodes can connect with ssh without password.
SSH configuration parameters are in path which is /home/username/.ssh/ . You have to make SSH configuration in connection user’s home directory. For example if you use oracle user for ssh connection, you have to use /home/oracle/.ssh/ path.
Create SSH Key on First Node
[oracle@test01 ~]$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Created directory ‘/home/oracle/.ssh’.
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:ea:68:e1:53:b5:9a:14:a9:b3:e6:58 oracle@test01
The key’s randomart image is:
+–[ RSA 2048]—-+
| |
| o |
| = . |
| . o o + |
| +S+ |
| . o.o.o |
| . + o. Eo |
| +.o. |
| ..o .o. |
+—————–+
[oracle@test01 ~]$
[oracle@test01 ~]$ cd /home/oracle/.ssh/
[oracle@test01 .ssh]$ ll
total 8
-rw——-. 1 oracle oinstall 1675 Oct 2 17:22 id_rsa
-rw-r–r–. 1 oracle oinstall 404 Oct 2 17:22 id_rsa.pub
Create SSH Key on Second Node
[oracle@test02 ~]$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Created directory ‘/home/oracle/.ssh’.
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:ea:68:e1:53:b5:9a:14:a9:b3:e6:58 oracle@test02
The key’s randomart image is:
+–[ RSA 2048]—-+
| o |
| o |
| = . |
| . o o + |
| +S+ |
| . .o.o |
| . + o. o |
| +.o. |
| ..o .o. |
+—————–+
[oracle@test02 ~]$
[oracle@test02 ~]$ cd /home/oracle/.ssh/
[oracle@test02 .ssh]$ ll
total 8
-rw——-. 1 oracle oinstall 1675 Oct 2 17:22 id_rsa
-rw-r–r–. 1 oracle oinstall 404 Oct 2 17:22 id_rsa.pub
Copy SSH Key From First Node To Second Node
[oracle@test01 ~]$ scp /home/oracle/.ssh/id_rsa.pub oracle@test02:/home/oracle/.ssh/authorized_keys
Copy SSH Key From Second Node To First Node
[oracle@test02 ~]$ scp /home/oracle/.ssh/id_rsa.pub oracle@test01:/home/oracle/.ssh/authorized_keys
Connection Test
[oracle@test01 ~]$ ssh oracle@test02
[oracle@test02 ~]$If you want to add another server, you can use cat or ssh-copy-id command.
Cat Command
Recommenned
[oracle@test01 ~]$ ssh-copy-id oracle@test03ssh-copy-id command adds automaticaly to authorized_keys.
or
[oracle@test03 ~]$ scp /home/oracle/.ssh/id_rsa.pub oracle@test01:/home/oracle/.ssh/id_rsa_test03.pub
[oracle@test01 ~]$ cat id_rsa_test03.pub >> authorized_keys