You are currently browsing the tag archive for the ‘without password’ tag.

Step 1. Generate ssh private key for PRIMARY Server

[oracle@PRIMARY ~]$ 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:
d9:a9:0b:d6:c7:fe:07:f0:78:89:9e:64:a4:56:39:5a oracle@PRIMARY.localdomain
[oracle@PRIMARY ~]$ ls -ltr
total 35212
drwxr-xr-x  2 oracle dba     4096 Jul 10 16:44 Desktop
-rw-r–r–  1 oracle dba 36010559 Jul 14 11:27 patch.log
[oracle@PRIMARY ~]$ cd .ssh
[oracle@PRIMARY .ssh]$ ls -ltr
total 8
-rw-r–r–  1 oracle dba 237 Jul 29 10:58 id_rsa.pub
-rw——-  1 oracle dba 883 Jul 29 10:58 id_rsa
[oracle@PRIMARY .ssh]$

Step 2. Generate ssh private key for STANDBY Server

[oracle@STANDBY ~]$ 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:
f7:13:39:d2:c4:08:41:fd:21:ac:8a:86:d9:42:aa:cc oracle@STANDBY
[oracle@STANDBY ~]$
[oracle@STANDBY ~]$ pwd
/home/oracle
[oracle@STANDBY ~]$ cd .ssh
[oracle@STANDBY .ssh]$ ls -ltr
total 8
-rw——-  1 oracle dba 887 Jul 29 01:56 id_rsa
-rw-r–r–  1 oracle dba 225 Jul 29 01:56 id_rsa.pub
[oracle@STANDBY .ssh]$

Step 3. Create Authorised Key for Both servers

[oracle@PRIMARY .ssh]$ pwd
/home/oracle/.ssh
[oracle@PRIMARY .ssh]$ touch authorized_keys
[oracle@PRIMARY .ssh]$

[oracle@STANDBY .ssh]$ pwd
/home/oracle/.ssh
[oracle@STANDBY .ssh]$ touch authorized_keys
[oracle@STANDBY .ssh]$

Step 4. Restart the ssh service on both servers

[root@STANDBY etc]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]

[root@PRIMARY etc]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]

Step 5.  Private key (id_rsa.pub) copy to own server and client server

[oracle@STANDBY .ssh]$ scp oracle@96.78.5.55:/home/oracle/.ssh/id_rsa.pub id_rsa.pub.PRIMARY
The authenticity of host ‘96.78.5.55 (96.78.5.55)’ can’t be established.
RSA key fingerprint is a1:89:2f:a9:0f:0e:2a:9e:45:c1:88:de:3c:51:61:01.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘96.78.5.55’ (RSA) to the list of known hosts.
oracle@96.78.5.55’s password:
id_rsa.pub                                                                                                                100%  237     0.2KB/s   00:00
[oracle@STANDBY .ssh]$

[oracle@PRIMARY .ssh]$ scp oracle@96.78.5.26:/home/oracle/.ssh/id_rsa.pub id_rsa.pub.STANDBY
The authenticity of host ‘96.78.5.26 (96.78.5.26)’ can’t be established.
RSA key fingerprint is 31:ab:fd:b3:3e:4d:bf:fe:c9:fa:0d:84:90:cd:d6:fc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘96.78.5.26’ (RSA) to the list of known hosts.
id_rsa.pub                                                                                                                100%  225     0.2KB/s   00:00
[oracle@PRIMARY .ssh]$ ls
authorized_keys  id_rsa  id_rsa.pub  id_rsa.pub.STANDBY  known_hosts
[oracle@PRIMARY .ssh]$ cat id_rsa.pub.STANDBY >>authorized_keys

Step 6. Test from Standby

[oracle@STANDBY ~]$ scp oracle@96.78.5.55:/home/oracle/.ssh/id_rsa.pub id_rsa.pub.PRIMARY
id_rsa.pub                                                                                                                100%  237     0.2KB/s   00:00
[oracle@STANDBY ~]$

Today

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Archives