linux 批量升级openssh8.0
updateopenssh.sh ckmsce=/home/updateopenssh.exp????? ? updateopenssh.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 [email?protected]$desthost expect "*assword:*" send "$passwordr"
expect {
?"*(yes/no)?" ? { ?? send "yesn" ?? expect "*assword:" {send "$passwordn"} ? } ?? "*assword:" ? { ??? send "$passwordn" ? } ? } expect "*#" send "scp [email?protected]:/root/openssh-8.0p1.tar.gz /root/ r" expect { ?"*(yes/no)?" ? { ?? send "yesn" ?? expect "*assword:" {send "$passwordn"} ? } ?? "*assword:" ? { ??? send "$passwordn" ? } ? }
expect "100%"
send "cd /etc/r"
expect "*#"
send "rm -rf ssh_bakr"
expect "*#"
send "cd /etc/init.d/r"
expect "*#"
send "rm -rf sshd_bakr" expect "*#" send "mv /etc/ssh /etc/ssh_bakr"
expect "*#"
send "/etc/init.d/sshd /etc/init.d/sshd_bakr"
expect "*#"
send "cd /root/r"
expect "*#"
send "tar xfz openssh-8.0p1.tar.gzr" sleep 3; expect "*#" send "cd /root/openssh-8.0p1/r"
expect "*#"
send -- "./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords--with-pam --with-tcp-wrappers? --with-ssl-dir=/usr/local/ssl --without-hardeningr" sleep 80; expect "*#" send "maker" sleep 80; expect "*#" send "make installr" sleep 80 expect "*#" send "yes | cp -a opensshd.init? /etc/init.d/sshdr" sleep 2;
expect "*#"
send "chmod +x /etc/init.d/sshdr" sleep 1;
expect "*#"
send "cat /etc/ssh/sshd_config | grep Perr" sleep 1;
expect "*#"
send "echo? ‘PermitRootLogin yes‘ >> /etc/ssh/sshd_configr" sleep 1;
expect "*#"
send "chmod +x /etc/init.d/sshdr" sleep 2;
expect "*#"
send "service sshd restartr" sleep 2;
expect "*#"
send "service sshd restartr" sleep 2;
interact
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- linux – 如何同时设置niceness和process affinity?
- linux – Amazon S3有“子目录”吗? (Rackspace Cloudfile
- linux – 如何设置Postfix以将邮件作为副本发送给多个本地用
- linux – 失败的通信线路……重新启动蠢货?
- 如何配置tmux从默认的底部到顶部移动窗口列表?
- linux – 获取Xorg内部活动客户端的完整列表
- linux – SSHFS通过多个连接
- Linux的Java剖析工具
- 使用quadmath的G 4.6.3 Linux中的四倍精度
- /usr/local/bin/python3:bad interpreter:ubuntu 14.04没