赞
踩
一、编写脚本
vim 26.sh
#!/usr/bin/expect
set timeout 1
spawn ssh root@10.0.0.26
expect "*password*"
send "password\r"
send "sudo -s\r"
send "cd /usr/local/\r"
interact
二、修改权限
sudo chmod +x ./26.sh
三、执行
./26.sh
四、如果出现未找到命令,安装了expect
yum install -y expect
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。