【SHELL】2 SSH自动登录脚本
来源:互联网 发布:linux 拷贝文件夹 编辑:程序博客网 时间:2024/06/14 17:30
实例一:
文件名:openssh1
#!/usr/bin/expect -f# SSH自动登录脚本# 作者Troyset timeout -1spawn ssh -l eda 10.10.80.202expect "password:"send "123456\r" # 密码interact #控制权移交执行:
./openssh1
实例二:
文件名:openssh2
#!/usr/bin/expect -f set timeout -1spawn ssh -l eda 10.10.80.202expect "password:"send "123456\r"expect "*$"send "mkdir hello\r"expect "*$" # 如果是root应该改为"*#"send "cd hello\r"expect "*$"send "ps -aux > hello.log\r"expect "*$"send "exit\r"interact执行:
./openssh2
PS:
expect默认是不安装的,安装方式如下:
1、Ubuntu
sudo apt-get install expect
2、Redhat
rpm -ivh tcl-8.3.5-88.i386.rpmrpm -ivh expect-5.38.0-88.i386.rpmrpm -ivh expect-devel-5.38.0-88.i386.rpm
- 【SHELL】2 SSH自动登录脚本
- 自动登录ssh的shell脚本
- shell脚本实现ssh自动登录
- ssh 自动登录脚本
- ssh自动登录脚本
- SSH自动登录脚本
- SSH自动登录脚本
- ssh 自动登录脚本
- SSH自动登录脚本
- Shell-自动登录脚本
- linux.ssh脚本自动登录
- ssh自动登录主机脚本
- Shell脚本实现自动登录
- shell脚本实现ssh自动登录-功能扩展,实现多个IP可选
- 实现ssh无密码登录 shell脚本
- 使用ssh登录shell脚本远程调用
- shell实现ssh自动登录远程主机
- Mac下ssh自动登录shell
- Unity3d资料备忘
- 总结LocalSessionFactoryBean加载Hibernate映射方式
- Hadoop Streaming 实战: 输出文件分割
- http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2467&cid=1131
- linux3.0.3
- 【SHELL】2 SSH自动登录脚本
- Fibonacci
- Factorial of large numbers bjfu1005 java实现大数阶乘
- ASP.NET中的注释
- UIButton
- PDB文件:每个开发人员都必须知道的
- U盘安装ubuntu12.10
- c++ map pair
- ubuntu usb转串口设置