auto ssh other linux host via expect
来源:互联网 发布:linux eth1 改为eth0 编辑:程序博客网 时间:2024/05/21 15:46
# cat /usr/bin/juli-auto-ssh-193.sh
#!/usr/bin/expect## Access CLIset loginUser "root"set loginPassword "911911911"set mgmtServerAddress "219.224.167.193"spawn ssh -l $loginUser $mgmtServerAddress -p 22 -Xset timeout 2expect "Are you sure you want to continue connecting (yes/no)? " {send "yes\r"}##interact with SSHset timeout 120expect "vrlab@219.224.167.193's password:" {send "$loginPassword\r"}interact
===============================
ref: http://www.thegeekstuff.com/2010/10/expect-examples/
SSH Login into Another Machine
The example expect program shown below automates the ssh login from one machine to another machine.
#!/usr/bin/expectset timeout 20set ip [lindex $argv 0]set user [lindex $argv 1]set password [lindex $argv 2]spawn ssh "$user\@$ip"expect "Password:"send "$password\r";interact
Execute the above expect program as shown below.
guest@host1 $ ./ssh.exp 192.168.1.2 root passwordspawn ssh root@192.168.1.2Password:Last login: Sat Oct 9 04:11:35 2010 from host1.geetkstuff.comroot@host2 #
0 0
- auto ssh other linux host via expect
- rz fail over expect auto login ssh
- Linux expect自动登录ssh
- Failed to connect to the host via ssh: ssh: connect to host 192.68.1.75 port 22: No route to host
- linux expect自动登录ssh,ftp
- linux expect自动登录ssh,ftp
- linux expect自动登录ssh,ftp...
- linux expect自动登录ssh,ftp
- linux expect自动登录ssh,ftp
- expect远程ssh连接linux终端
- linux expect自动登录ssh,ftp
- linux expect自动登录ssh,ftp
- linux expect详解(ssh自动登录)
- linux expect详解(ssh自动登录)
- linux expect自动登录ssh,ftp
- linux expect自动登录ssh,ftp
- linux expect自动登录ssh,ftp
- linux expect详解(ssh自动登录)
- 用python + openpyxl处理excel(07+)文档 + 一些中文处理的技巧
- XML入门(一)
- ARM Linux系统调用的原理
- 一直在DEBUG整理
- spring学习笔记
- auto ssh other linux host via expect
- 当UIScrollView 遇到 autolayout
- Segmentation fault 问题浅谈
- SQL中concat()函数、substr()函数与length()函数
- 对一组数乱序
- 解决DB2的一个BUG收获(SQLCode=-805, SQLState=51002, error message=DB2 SQL Error: SQLCODE=-805, SQLSTATE=5100
- linux下c/c++实例之十一简单的计算器程序
- C++ 继承与多重继承
- URL中的特殊字符