使用Oracle安装包的ssh配置机器互信

联系:QQ(5163721)

标题:使用Oracle安装包的ssh配置机器互信

作者:Lunar©版权所有[文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.]

[oracle@lunar test]$ ./sshUsersetup.sh -user oracle -hosts "192.168.56.66 192.168.56.101"
The output of this script is also logged into /tmp/sshUserSetup_2013-10-27-00-39-03.log
Hosts are 192.168.56.66 192.168.56.101
user is oracle
Platform:- Linux
Checking if the remote hosts are reachable
PING 192.168.56.66 (192.168.56.66) 56(84) bytes of data.
64 bytes from 192.168.56.66: icmp_seq=1 ttl=64 time=0.029 ms
64 bytes from 192.168.56.66: icmp_seq=2 ttl=64 time=0.071 ms
64 bytes from 192.168.56.66: icmp_seq=3 ttl=64 time=0.046 ms
64 bytes from 192.168.56.66: icmp_seq=4 ttl=64 time=0.036 ms
64 bytes from 192.168.56.66: icmp_seq=5 ttl=64 time=0.047 ms

--- 192.168.56.66 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.029/0.045/0.071/0.016 ms
PING 192.168.56.101 (192.168.56.101) 56(84) bytes of data.
64 bytes from 192.168.56.101: icmp_seq=1 ttl=64 time=2.86 ms
64 bytes from 192.168.56.101: icmp_seq=2 ttl=64 time=1.79 ms
64 bytes from 192.168.56.101: icmp_seq=3 ttl=64 time=1.46 ms
64 bytes from 192.168.56.101: icmp_seq=4 ttl=64 time=1.07 ms
64 bytes from 192.168.56.101: icmp_seq=5 ttl=64 time=0.625 ms

--- 192.168.56.101 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 0.625/1.563/2.864/0.759 ms
Remote host reachability check succeeded.
The following hosts are reachable: 192.168.56.66 192.168.56.101.
The following hosts are not reachable: .
All hosts are reachable. Proceeding further...
firsthost 192.168.56.66
numhosts 2
The script will setup SSH connectivity from the host lunar 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 lunar
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
Please specify if you want to specify a passphrase for the private key this script will create for the local host. Passphrase is used to encrypt the private key and makes SSH much more secure. Type 'yes' or 'no' and then press enter. In case you press 'yes', you would need to enter the passphrase whenever the script executes ssh or scp.
The estimated number of times the user would be prompted for a passphrase is 4. In addition, if the private-public files are also newly created, the user would have to specify the passphrase on one additional occasion.
Enter 'yes' or 'no'.
yes

The user chose yes
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
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
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:
9a:15:b2:57:0f:79:28:33:3a:0f:7c:e3:42:61:5f:22 oracle@lunar
Creating .ssh directory and setting permissions on remote host 192.168.56.66
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 ~oracle/.ssh/config file on remote host 192.168.56.66. If a config file exists already at ~oracle/.ssh/config, it would be backed up to ~oracle/.ssh/config.backup.
The user may be prompted for a password here since the script would be running SSH on host 192.168.56.66.
Warning: Permanently added '192.168.56.66' (RSA) to the list of known hosts.
oracle@192.168.56.66's password:
Done with creating .ssh directory and setting permissions on remote host 192.168.56.66.
Creating .ssh directory and setting permissions on remote host 192.168.56.101
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 ~oracle/.ssh/config file on remote host 192.168.56.101. If a config file exists already at ~oracle/.ssh/config, it would be backed up to ~oracle/.ssh/config.backup.
The user may be prompted for a password here since the script would be running SSH on host 192.168.56.101.
Warning: Permanently added '192.168.56.101' (RSA) to the list of known hosts.
oracle@192.168.56.101's password:
Done with creating .ssh directory and setting permissions on remote host 192.168.56.101.
Copying local host public key to the remote host 192.168.56.66
The user may be prompted for a password or passphrase here since the script would be using SCP for host 192.168.56.66.
oracle@192.168.56.66's password:
Done copying local host public key to the remote host 192.168.56.66
Copying local host public key to the remote host 192.168.56.101
The user may be prompted for a password or passphrase here since the script would be using SCP for host 192.168.56.101.
oracle@192.168.56.101's password:
Done copying local host public key to the remote host 192.168.56.101
The script will run SSH on the remote machine 192.168.56.66. The user may be prompted for a passphrase here in case the private key has been encrypted with a passphrase.
The script will run SSH on the remote machine 192.168.56.101. The user may be prompted for a passphrase here in case the private key has been encrypted with a passphrase.
cat: /home/oracle/.ssh/known_hosts.tmp: No such file or directory
cat: /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. ~oracle or ~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 <OMS HOME>/sysman/prov/resources/ignoreMessages.txt file.
------------------------------------------------------------------------
--192.168.56.66:--
Running /usr/bin/ssh -x -l oracle 192.168.56.66 date to verify SSH connectivity has been setup from local host to 192.168.56.66.
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.
The script will run SSH on the remote machine 192.168.56.66. The user may be prompted for a passphrase here in case the private key has been encrypted with a passphrase.
Sun Oct 27 00:39:51 GMT+8 2013
------------------------------------------------------------------------
--192.168.56.101:--
Running /usr/bin/ssh -x -l oracle 192.168.56.101 date to verify SSH connectivity has been setup from local host to 192.168.56.101.
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.
The script will run SSH on the remote machine 192.168.56.101. The user may be prompted for a passphrase here in case the private key has been encrypted with a passphrase.
Sun Oct 27 16:38:47 GMT+8 2013
------------------------------------------------------------------------
SSH verification complete.
[oracle@lunar test]$
[oracle@lunar test]$
[oracle@lunar test]$
[oracle@lunar test]$ ssh 192.168.56.66
[oracle@lunar ~]$ ssh 192.168.56.101
[oracle@lunar ~]$ exit
logout
Connection to 192.168.56.101 closed.
[oracle@lunar ~]$
此条目发表在 FAQ 分类目录,贴了 , 标签。将固定链接加入收藏夹。

使用Oracle安装包的ssh配置机器互信》有 1 条评论

  1. Pingback 引用通告: 解除部分exadata上的“强安全策略” | Lunar的oracle实验室

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>