Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oralce comes with a script to create mutual trust-sshUserSetup.sh

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Oracle 12cR1 test comes with a mutual trust script, and the path is under. / grid/sshsetup/ after the installation file is unzipped.

1. Script path

$cd / soft/grid

$ls

Install response rpm runcluvfy.sh runInstaller sshsetup stage welcome.html

$cd sshsetup/

$ls

SshUserSetup.sh

$

two。 Script help

$cd / soft/grid/

$ls

Install response rpm runcluvfy.sh runInstaller sshsetup stage welcome.html

. / sshsetup/sshUserSetup.sh-h

Please specify a valid and existing cluster configuration file.

Either user name or host information is missing

Usage. / sshsetup/sshUserSetup.sh-user [- hosts "" |-hostfile] [- advanced] [- verify] [- exverify] [- logfile] [- confirm] [- shared] [- help] [- usePassphrase] [- noPromptPassphrase]

3. To execute the script, you need to enter the user and hostname, and then enter the password

$. / sshsetup/sshUserSetup.sh-user grid-hosts "roidb01 roidb02"-advanced-noPromptPassphrase

The output of this script is also logged into / tmp/sshUserSetup_2017-09-14-08-02-35.log

Hosts are roidb01 roidb02

User is grid

Platform:- Linux

Checking if the remote hosts are reachable

PING roidb01 (192.168.1.111) 56 (84) bytes of data.

64 bytes from roidb01 (192.168.1.111): icmp_seq=1 ttl=64 time=0.014 ms

64 bytes from roidb01 (192.168.1.111): icmp_seq=2 ttl=64 time=0.020 ms

64 bytes from roidb01 (192.168.1.111): icmp_seq=3 ttl=64 time=0.023 ms

64 bytes from roidb01 (192.168.1.111): icmp_seq=4 ttl=64 time=0.022 ms

64 bytes from roidb01 (192.168.1.111): icmp_seq=5 ttl=64 time=0.022 ms

-roidb01 ping statistics

5 packets transmitted, 5 received, 0 packet loss, time 3999ms

Rtt min/avg/max/mdev = 0.014 ms 0.020 Universe 0.023 Universe 0.004

PING roidb02 (192.168.1.112) 56 (84) bytes of data.

64 bytes from roidb02 (192.168.1.112): icmp_seq=1 ttl=64 time=0.314 ms

64 bytes from roidb02 (192.168.1.112): icmp_seq=2 ttl=64 time=0.159 ms

64 bytes from roidb02 (192.168.1.112): icmp_seq=3 ttl=64 time=0.198 ms

64 bytes from roidb02 (192.168.1.112): icmp_seq=4 ttl=64 time=0.200 ms

64 bytes from roidb02 (192.168.1.112): icmp_seq=5 ttl=64 time=0.322 ms

-roidb02 ping statistics

5 packets transmitted, 5 received, 0 packet loss, time 4001ms

Rtt min/avg/max/mdev = 0.159 ms, 0.238, 0.322, and 0.068

Remote host reachability check succeeded.

The following hosts are reachable: roidb01 roidb02.

The following hosts are not reachable:.

All hosts are reachable. Proceeding further...

Firsthost roidb01

Numhosts 2

The script will setup SSH connectivity from the host roidb01 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 roidb01

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 PRIVILEDGES TO THESE

Directories.

Do you want to continue and let the script make the above mentioned changes (yes/no)?

Yes

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 / home/oracle/.ssh/config, it would be backed up to / home/oracle/.ssh/config.backup.

Removing old private/public keys on local host

Running SSH keygen on local host with empty passphrase

Generating public/private rsa key pair.

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:

6e:ce:31:81:d0:9a:8e:fe:04:2b:e1:68:49:17:46:4d oracle@roidb01

The key's randomart p_w_picpath is:

+-[RSA 1024]-+

| | .oE |

|. O |

| o. | |

|. . +. | |

|. O. S |

| + .o =. . | |

| | oonymo = |

| .o. + o |

|. O |

+-+

Creating .ssh directory and setting permissions on remote host roidb01

THE SCRIPT WOULD ALSO BE REVOKING WRITE PERMISSIONS FOR group AND others ON THE HOME DIRECTORY FOR grid. THIS IS AN SSH REQUIREMENT.

The script would create ~ grid/.ssh/config file on remote host roidb01. If a config file exists already at ~ grid/.ssh/config, it would be backed up to ~ grid/.ssh/config.backup.

The user may be prompted for a password here since the script would be running SSH on host roidb01.

Warning: Permanently added 'roidb01192.168.1.111' (ECDSA) to the list of known hosts.

Grid@roidb01's password:

Done with creating .ssh directory and setting permissions on remote host roidb01.

Creating .ssh directory and setting permissions on remote host roidb02

THE SCRIPT WOULD ALSO BE REVOKING WRITE PERMISSIONS FOR group AND others ON THE HOME DIRECTORY FOR grid. THIS IS AN SSH REQUIREMENT.

The script would create ~ grid/.ssh/config file on remote host roidb02. If a config file exists already at ~ grid/.ssh/config, it would be backed up to ~ grid/.ssh/config.backup.

The user may be prompted for a password here since the script would be running SSH on host roidb02.

Warning: Permanently added 'roidb02192.168.1.112' (ECDSA) to the list of known hosts.

Grid@roidb02's password:

Done with creating .ssh directory and setting permissions on remote host roidb02.

Copying local host public key to the remote host roidb01

The user may be prompted for a password or passphrase here since the script would be using SCP for host roidb01.

Grid@roidb01's password:

Done copying local host public key to the remote host roidb01

Copying local host public key to the remote host roidb02

The user may be prompted for a password or passphrase here since the script would be using SCP for host roidb02.

Grid@roidb02's password:

Done copying local host public key to the remote host roidb02

Creating keys on remote host roidb01 if they do not exist already. This is required to setup SSH on host roidb01.

Generating public/private rsa key pair.

Your identification has been saved in .ssh / id_rsa.

Your public key has been saved in .ssh / id_rsa.pub.

The key fingerprint is:

29:1f:ed:1c:a2:9c:5b:a1:d9:be:71:32:6d:b1:05:fb grid@roidb01

The key's randomart p_w_picpath is:

+-[RSA 1024]-+

| | |

| | |

|. | |

| | o o |

|. S =. | |

|. OB * |

| | * B B E |

| | + * |

|. O. |

+-+

Creating keys on remote host roidb02 if they do not exist already. This is required to setup SSH on host roidb02.

Generating public/private rsa key pair.

Your identification has been saved in .ssh / id_rsa.

Your public key has been saved in .ssh / id_rsa.pub.

The key fingerprint is:

7b:84:f0:b2:f2:89:d9:f3:fb:38:38:65:50:ce:0a:11 grid@roidb02

The key's randomart p_w_picpath is:

+-[RSA 1024]-+

| | E. |

|. . | |

| |.. + |

|. .oo. | |

|.. oS. | |

| | .ooo |

|. . +. . | |

| | * + .o |

| o +. | |

+-+

Updating authorized_keys file on remote host roidb01

Updating known_hosts file on remote host roidb01

Updating authorized_keys file on remote host roidb02

Updating known_hosts file on remote host roidb02

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 grid.

2. The server may have disabled public key based authentication.

3. The client public key on the server may be outdated.

4. ~ grid or ~ grid/.ssh on the remote host may not be owned by grid.

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.

-- roidb01:--

Running / usr/bin/ssh-x-l grid roidb01 date to verify SSH connectivity has been setup from local host to roidb01.

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.

Thu Sep 14 08:03:37 CST 2017

-- roidb02:--

Running / usr/bin/ssh-x-l grid roidb02 date to verify SSH connectivity has been setup from local host to roidb02.

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.

Thu Sep 14 08:03:37 CST 2017

Verifying SSH connectivity has been setup from roidb01 to roidb01

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.

Thu Sep 14 08:03:38 CST 2017

Verifying SSH connectivity has been setup from roidb01 to roidb02

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.

Thu Sep 14 08:03:38 CST 2017

-Verification from complete-

SSH verification complete.

$ssh roidb02 date

Oracle@roidb02's password:

Permission denied, please try again.

Oracle@roidb02's password:

Permission denied, please try again.

Oracle@roidb02's password:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

4. Test verification

$ssh roidb02

Oracle@roidb02's password:

$whoami

Oracle

$exit

Logout

[root@roidb01 ~] # su-grid

Last login: Thu Sep 14 07:58:16 CST 2017

$ssh roidb02 date

Thu Sep 14 08:05:01 CST 2017

$

$ssh roidb01 date

Thu Sep 14 08:09:57 CST 2017

$

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report