摘录一 在192.168.42.142机器上 1)运行:ssh-keygen -t rsa 2)然后拍两下回车(均选择默认) 3)运行: ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.42.163 或普通用户: ssh-copy-...
分类:
其他好文 时间:
2015-06-20 22:04:41
阅读次数:
267
#!/usr/bin/perluseExpect;#前提是你的服务器上得有Expect包,没有请安装,否无法使用交互my$PROMPT=‘[\]\$\>\#]\s*$‘;#远程系统的命令提示符模式@a=qw#100.100.100.200root#;#假设你要登陆的主机ip是100.100.100.200用户是root$obj=Expect->spawn("ssh-l$a[1]$a[0]")ord..
分类:
其他好文 时间:
2015-06-17 01:54:38
阅读次数:
130
expectexpect是可以实现服务器之间自动交互的工具I、expect安装expect工具是否安装:在Linux系统命令行执行whichexpect,若返回/usr/bin/expect表示已经安装过,反之则没有安装。expect安装说明:安装有RPM包可下载expect的RPM包,依赖tcl包,所以tcl也要一并安装。expect安装..
分类:
其他好文 时间:
2015-06-16 19:28:44
阅读次数:
95
摘录一
在192.168.42.142机器上
1)运行:ssh-keygen -t rsa
2)然后拍两下回车(均选择默认)
3)运行:
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.42.163
或普通用户:
ssh-copy-id NAME@IP
4)再输入163机器上的root密码
...
分类:
其他好文 时间:
2015-06-12 17:24:29
阅读次数:
212
一、环境系统:CentOS6.4x64最小化安装node1192.168.3.61node1.test.comnode2192.168.3.62node2.test.comvip192.168.3.63二、基础配置a.配置ssh互信node1:[root@node1~]#ssh-keygen
[root@node1~]#ssh-copy-id-i~/.ssh/id_rsa.pubroot@192.168.3.62node2:[root@node2~]#ssh-key..
分类:
数据库 时间:
2015-06-11 23:17:07
阅读次数:
814
实现真正的自动化,expect脚本语言使用expect中的几个重要句子:expect的核心是spawnexpectsendsetspawn调用要执行的命令expect等待命令提示信息的出现,也就是捕捉用户输入的提示:send发送需要交互的值,替代了用户手动输入内容set设置变量值interact执行完成后保持交互状态..
分类:
编程语言 时间:
2015-06-10 12:32:38
阅读次数:
183
shell脚本需要交互的地方可以使用here文档是实现,但是有些命令却需要用户手动去就交互如passwd、scp,对自动部署免去用户交互很痛苦,expect能很好的解决这类问题。expect的核心是spawn expect send set spawn 调用要执行的命令 等待命令提示信息的出现,也....
分类:
系统相关 时间:
2015-06-10 10:16:15
阅读次数:
318
1:以 root为例[root@shell deploy]# ssh-keygen直接回车到底通过ssh-cpoy-id自带脚本来拷贝公钥到客户机命令格式:[root@shell ~]# ssh-copy-idUsage: /usr/bin/ssh-copy-id [-i [identity_fil...
分类:
其他好文 时间:
2015-06-08 19:31:46
阅读次数:
115
适配器模式:
将一个类的接口转换成另外一个期望的类的接口。适配器允许接口互不兼容的类一起工作。Convert the interface of a class into another interface clients expect.
Adapter lets classes work together that couldn't otherwise because of
incompati...
分类:
其他好文 时间:
2015-06-07 13:53:29
阅读次数:
169
今天在玩Linux,在root与普通用户之间切换,老是要输入密码,然后突然有个想法,自己写个shell脚本执行自动切换此不是更方便,瞎搞了一下不行,然后google上搜一下,原来纯shell做不了这个事,要用expect,以下安装步骤:1:下载需要用到的包,因为安装expect要用到tcl,tcl下...
分类:
其他好文 时间:
2015-06-05 00:23:28
阅读次数:
190