Before starting RAC setup between two nodes, we need to have password less ssh connectivity between the nodes.
There is a manual process to enable ssh connectivity . However oracle is providing a simple sshUserSetup.sh script, that will automate the steps.
sshUserSetup.sh script will be available inside the grid software.
db nodes – > dbhost1 , dbhost2
grid user – > oracle
./sshUserSetup.sh -user oracle -hosts “dbhost1 dbhost2” -noPromptPassphrase -confirm -advanced
oracle@dbhost1:...a/oracle/app/grid19c/deinstall$ ./sshUserSetup.sh -user oracle -hosts "dbhost1 dbhost2" -noPromptPassphrase -confirm -advanced
The output of this script is also logged into /tmp/sshUserSetup_2020-12-01-17-35-16.log
Hosts are dbhost1 dbhost2
user is oracle
Platform:- SunOS
Checking if the remote hosts are reachable
PING dbhost1: 5 data bytes
13 bytes from dbhost1 (172.21.62.95): icmp_seq=0.
13 bytes from dbhost1 (172.21.62.95): icmp_seq=1.
13 bytes from dbhost1 (172.21.62.95): icmp_seq=2.
13 bytes from dbhost1 (172.21.62.95): icmp_seq=3.
13 bytes from dbhost1 (172.21.62.95): icmp_seq=4.
----dbhost1 PING Statistics----
5 packets transmitted, 5 packets received, 0% packet loss
PING dbhost2: 5 data bytes
13 bytes from dbhost2 (172.21.62.96): icmp_seq=0.
13 bytes from dbhost2 (172.21.62.96): icmp_seq=1.
13 bytes from dbhost2 (172.21.62.96): icmp_seq=2.
13 bytes from dbhost2 (172.21.62.96): icmp_seq=3.
13 bytes from dbhost2 (172.21.62.96): icmp_seq=4.
----dbhost2 PING Statistics----
5 packets transmitted, 5 packets received, 0% packet loss
Remote host reachability check succeeded.
The following hosts are reachable: dbhost1 dbhost2.
The following hosts are not reachable: .
All hosts are reachable. Proceeding further...
firsthost dbhost1
numhosts 0
The script will setup SSH connectivity from the host dbhost1 to all
the remote hosts. After the script is executed, the user can use SSH to run
commands on the remote hosts or copy files between this host dbhost1
and the remote hosts without being prompted for passwords or confirmations.
NOTE 1:
As part of the setup procedure, this script will use ssh and scp to copy
files between the local host and the remote hosts. Since the script does not
store passwords, you may be prompted for the passwords during the execution of
the script whenever ssh or scp is invoked.
NOTE 2:
AS PER SSH REQUIREMENTS, THIS SCRIPT WILL SECURE THE USER HOME DIRECTORY
AND THE .ssh DIRECTORY BY REVOKING GROUP AND WORLD WRITE PRIVILEGES TO THESE
directories.
Do you want to continue and let the script make the above mentioned changes (yes/no)?
Confirmation provided on the command line
The user chose yes
User chose to skip passphrase related questions.
Creating .ssh directory on local host, if not present already
Creating authorized_keys file on local host
Changing permissions on authorized_keys to 644 on local host
Creating known_hosts file on local host
Changing permissions on known_hosts to 644 on local host
Creating config file on local host
If a config file exists already at /export/home/oracle/.ssh/config, it would be backed up to /export/home/oracle/.ssh/config.backup.
Creating .ssh directory and setting permissions on remote host dbhost1
THE SCRIPT WOULD ALSO BE REVOKING WRITE PERMISSIONS FOR group AND others ON THE HOME DIRECTORY FOR oracle. THIS IS AN SSH REQUIREMENT.
The script would create /export/home/oracle/.ssh/config file on remote host dbhost1. If a config file exists already at /export/home/oracle/.ssh/config, it would be backed up to /export/home/oracle/.ssh/config.backup.
The user may be prompted for a password here since the script would be running SSH on host dbhost1.
Warning: Permanently added 'dbhost1,172.21.62.95' (ED25519) to the list of known hosts.
Password:
Done with creating .ssh directory and setting permissions on remote host dbhost1.
Creating .ssh directory and setting permissions on remote host dbhost2
THE SCRIPT WOULD ALSO BE REVOKING WRITE PERMISSIONS FOR group AND others ON THE HOME DIRECTORY FOR oracle. THIS IS AN SSH REQUIREMENT.
The script would create /export/home/oracle/.ssh/config file on remote host dbhost2. If a config file exists already at /export/home/oracle/.ssh/config, it would be backed up to /export/home/oracle/.ssh/config.backup.
The user may be prompted for a password here since the script would be running SSH on host dbhost2.
Warning: Permanently added 'dbhost2,172.21.62.96' (ED25519) to the list of known hosts.
Done with creating .ssh directory and setting permissions on remote host dbhost2.
Copying local host public key to the remote host dbhost1
The user may be prompted for a password or passphrase here since the script would be using SCP for host dbhost1.
Password:
Done copying local host public key to the remote host dbhost1
Copying local host public key to the remote host dbhost2
The user may be prompted for a password or passphrase here since the script would be using SCP for host dbhost2.
Done copying local host public key to the remote host dbhost2
Creating keys on remote host dbhost1 if they do not exist already. This is required to setup SSH on host dbhost1.
Creating keys on remote host dbhost2 if they do not exist already. This is required to setup SSH on host dbhost2.
Updating authorized_keys file on remote host dbhost1
Updating known_hosts file on remote host dbhost1
Updating authorized_keys file on remote host dbhost2
Updating known_hosts file on remote host dbhost2
cat: cannot open /export/home/oracle/.ssh/known_hosts.tmp: No such file or directory
cat: cannot open /export/home/oracle/.ssh/authorized_keys.tmp: No such file or directory
SSH setup is complete.
------------------------------------------------------------------------
Verifying SSH setup
===================
The script will now run the date command on the remote nodes using ssh
to verify if ssh is setup correctly. IF THE SETUP IS CORRECTLY SETUP,
THERE SHOULD BE NO OUTPUT OTHER THAN THE DATE AND SSH SHOULD NOT ASK FOR
PASSWORDS. If you see any output other than date or are prompted for the
password, ssh is not setup correctly and you will need to resolve the
issue and set up ssh again.
The possible causes for failure could be:
1. The server settings in /etc/ssh/sshd_config file do not allow ssh
for user oracle.
2. The server may have disabled public key based authentication.
3. The client public key on the server may be outdated.
4. /export/home/oracle or /export/home/oracle/.ssh on the remote host may not be owned by oracle.
5. User may not have passed -shared option for shared remote users or
may be passing the -shared option for non-shared remote users.
6. If there is output in addition to the date, but no password is asked,
it may be a security alert shown as part of company policy. Append the
additional text to the /sysman/prov/resources/ignoreMessages.txt file.
------------------------------------------------------------------------
--dbhost1:--
Running /usr/bin/ssh -x -l oracle dbhost1 date to verify SSH connectivity has been setup from local host to dbhost1.
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL. Please note that being prompted for a passphrase may be OK but being prompted for a password is ERROR.
Tue Dec 1 17:35:34 +03 2020
------------------------------------------------------------------------
--dbhost2:--
Running /usr/bin/ssh -x -l oracle dbhost2 date to verify SSH connectivity has been setup from local host to dbhost2.
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL. Please note that being prompted for a passphrase may be OK but being prompted for a password is ERROR.
Tue Dec 1 17:35:35 +03 2020
------------------------------------------------------------------------
------------------------------------------------------------------------
Verifying SSH connectivity has been setup from dbhost1 to dbhost1
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL.
Tue Dec 1 17:35:35 +03 2020
------------------------------------------------------------------------
------------------------------------------------------------------------
Verifying SSH connectivity has been setup from dbhost1 to dbhost2
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL.
Tue Dec 1 17:35:35 +03 2020
------------------------------------------------------------------------
-Verification from complete-
SSH verification complete.
Now test ssh connectivity between the nodes: