Oralce 自带创建互信脚本-sshUserSetup.sh

Oracle 12cR1 测试自带互信脚本,路径为安装文件解压后的./grid/sshsetup/下

1.脚本路径

<roidb01:+ASM:/home/grid>$cd /soft/grid
<roidb01:+ASM:/soft/grid>$ls
install  response  rpm  runcluvfy.sh  runInstaller  sshsetup  stage  welcome.html
<roidb01:+ASM:/soft/grid>$cd sshsetup/
<roidb01:+ASM:/soft/grid/sshsetup>$ls
sshUserSetup.sh
<roidb01:+ASM:/soft/grid/sshsetup>$

2.脚本帮助

<roidb01:orcl:/home/oracle>$cd /soft/grid/
<roidb01:orcl:/soft/grid>$ls
install  response  rpm  runcluvfy.sh  runInstaller  sshsetup  stage  welcome.html
<roidb01:orcl:/soft/grid>$./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 <user name> [ -hosts "<space separated hostlist>" | -hostfile <absolute path of cluster configuration file> ] [ -advanced ]  [ -verify] [ -exverify ] [ -logfile <desired absolute path of logfile> ] [-confirm] [-shared] [-help] [-usePassphrase] [-noPromptPassphrase]

3.执行脚本,需要输入用户和主机名,后续还要输入密码

<roidb01:orcl:/soft/grid>$./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/0.020/0.023/0.004 ms
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/0.238/0.322/0.068 ms
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 [email protected]
The key‘s randomart image is:
+--[ RSA 1024]----+
|   .oE           |
|  .  o           |
|   o. .          |
|  . .+ .         |
|....o . S        |
|+.o=   . .       |
|o+o o   =        |
|.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 ‘roidb01,192.168.1.111‘ (ECDSA) to the list of known hosts.
[email protected]‘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 ‘roidb02,192.168.1.112‘ (ECDSA) to the list of known hosts.
[email protected]‘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.
[email protected]‘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.
[email protected]‘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 [email protected]
The key‘s randomart image is:
+--[ RSA 1024]----+
|                 |
|                 |
|          .      |
|         o o     |
|      . S = .    |
|     . O B *     |
|      * 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 [email protected]
The key‘s randomart image 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 <OMS HOME>/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.
<roidb01:orcl:/soft/grid>$ssh roidb02 date
[email protected]‘s password:
Permission denied, please try again.
[email protected]‘s password:
Permission denied, please try again.
[email protected]‘s password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

4.测试验证

<roidb01:orcl:/soft/grid>$ssh roidb02
[email protected]‘s password:

<roidb01:orcl:/soft/grid>$whoami
oracle
<roidb01:orcl:/soft/grid>$exit
logout
[[email protected] ~]# su - grid
Last login: Thu Sep 14 07:58:16 CST 2017
<roidb01:+ASM:/home/grid>$ssh roidb02 date
Thu Sep 14 08:05:01 CST 2017

<roidb01:+ASM:/home/grid>$

<roidb02:+ASM:/home/grid>$ssh roidb01 date
Thu Sep 14 08:09:57 CST 2017

<roidb02:+ASM:/home/grid>$

时间: 2024-10-03 15:01:34

Oralce 自带创建互信脚本-sshUserSetup.sh的相关文章

经典实用的自动创建Bash脚本文件头的脚本

今天给大家展示一下,我自己写的一个自动创建Bash脚本文件头的脚本(名为create),希望能对初学脚本者带来一定的思维提示.毕竟对于一个经常写脚本的运维人员来说,每次写脚本的时候都需要重复的去写一遍文件头,也是一件很累赘的事情,既然我们学了脚本,为什么不让它来为我们减轻一下负担了.所以一个自动创建Bash脚本文件头的想法在我脑海里面产生了. 本脚本所需要实现的功能: 1,能够自动创建一个标准的Bash脚本文件头,带有详细注释信息 2,能够给新建完成的Bash脚本文件自动添加执行权限 [[ema

omcat运行控制脚本catalina.sh分析

分析catalina.sh脚本的目的,一个是学习脚本中shell的各类用法,还有就是为编写tomcat多服务器远程启动脚本做准备,实现版本上线自动化无人干预部署,此前作者已发表" tomcat变量环境脚本setclasspath.sh分析"来为此篇作为铺垫,需要两篇文章一起看,才能全面的分析出tomcat的启动过程. tomcat版本:6.0.35 #!/bin/sh # Licensed to the Apache Software Foundation (ASF) under on

《转》Unity3D研究院编辑器之创建Lua脚本模板

Unity里能创建 c#脚本模板,但是如果我想创建Lua脚本模板怎么办呢?拓展一下编辑器吧. 设置一下Lua脚本的模板地址 :  Assets/Editor/Lua/Template/lua.lua using UnityEngine; using UnityEditor; using System; using System.IO; using System.Text; using UnityEditor.ProjectWindowCallback; using System.Text.Reg

shell编写的多服务器自动互信脚本(安装ceph)

相信大家都使用过分布式存储,而在分布式存储中较为出色的非ceph莫属了,但是这里就不深入聊ceph啦,我们只是聊聊安装ceph时遇到的问题. ceph需要多台主机进行ssh互信.三台还能忍受,但是当超过三台那工作量想想就令人发指,而且都是重复性的动作.这类操作必须要优化掉. 因此用shell写了一个多服务器互信脚本,仅供大家借鉴参考.具体脚本已经上传至github可在本公众号代码仓库中找到install_ceph进行下载使用. 代码不多说了比较简单,相信大家都能看懂! 这里只讲几点我当时的书写思

SQL创建表脚本

<1>SQL Server设置主键自增长列 SQL Server设置主键自增长列 1.新建一数据表,里面有字段id,将id设为为主键 www.2cto.com create table tb(id int,constraint pkid primary key (id)) create table tb(id int primary key ) 2.新建一数据表,里面有字段id,将id设为主键且自动编号 create table tb(id int identity(1,1),constrai

sqlserver导出带数据的脚本

说明: 以前要将一个表中的数据导出为脚本,只有用存储过程.现在在SQL Server 2008中增加了一个新特性,除了导出表的定义外,还支持将表中的数据导出为脚本. 步骤: 右击需要导出数据的数据库,在弹出式菜单中选择"任务"下的"生成脚本"选项 在第二步选择"高级选项"如果不是2008(R2)的选择 "编写数据的脚本"选择为TRUE,这里默认是为FALSE的 ,   是2008(R2)的选择"要编写的脚本的数据的类

Exchange 2013 PowerShell创建自定义脚本

我们可以通过执行单条命令或者结合管道运行多条命令来完成很多任务,但是有时你想创建一个脚本,执行一系列的操作或者加载一个函数库或者预定义变量或别名在Shell中,这一节,我们将学习创建脚本以及运行脚本 怎么做呢? 1.  让我们创建一个基本的脚本,来自动执行一个多步骤的过程.启用文本编辑器,输入如下代码: param( $name, $maxsendsize, $maxreceivesize, $city, $state, $title, $department ) Set-Mailbox -Id

freescale-sdk linux移植一搭建编译环境脚本host-prepare.sh分析

接下来使用自己的课外休息时间,对基于PowerPC架构freescale-sdk,进行linux移植和分析.主要参考官方文档freescale linux sdk START_HERE.html,首先对搭建编译环境脚本host-prepare.sh分析.在移植系统之前,需要搭建编译环境,安装必要的包,为后期编译系统做准备.很多人看到脚本就头疼,下面是我的分析过程,分析不好的地方可以在下面留言,一起讨论. 一.搭建编译环境脚本分析./scripts/host-prepare.sh [email p

Ubuntu创建用户脚本

在工作中,经常需要为Ubuntu添加用户,配置用户初始密码,配置组,通过脚本可以快速的实现这一工作: #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/ucb:/usr/local/bin GROUP_NAME=devs USER_CREATED=$* USER_PASSWD=ubuntu if [ "$1" != "" ]; then echo "Create User: $USER_CREATED&