linux 批量安装telnet脚本

匿名 (未验证) 提交于 2019-12-02 21:56:30

install_telnet.sh





omplist="
192.167.1.1
192.167.1.2
192.167.1.3








#-------------------------------------

install_telnet.exp

#!/usr/bin/expect -f
set date [exec date -d day +'%Y%m%d']
set desthost [lindex $argv 0]
set username [lindex $argv 1]
set password [lindex $argv 2]
set port [lindex $argv 3]

spawn ssh -D $port $username@$desthost
expect "*assword:*"
send "$password\r"
expect {









expect "*#"
send "cd /home/Packages/\r"
expect "*#"
send -- "rpm -ivh telnet-server-0.17-47.el6_3.1.x86_64.rpm\r"
sleep 3;
expect "*#"
send -- "rpm -ivh telnet-0.17-47.el6_3.1.x86_64.rpm\r"
sleep 3;
expect "*#"
send -- "rpm -ivh xinetd-2.3.14-38.el6.x86_64.rpm\r"
sleep 3;
expect "*#"
expect "*#"
expect "*#"
expect "*#"
expect "*#"
expect "*#"
expect "*#"
expect "*#"
expect "*#"

sleep 2;
expect "*#"

sleep 2;

send "exit\r"

interact

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!