centos7 升级openssh
#!/bin/sh cp /etc/pam.d/sshd /tmp cd /tmp yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel pam* zlib* wget http://mirrors.shanghai-electric.com:8081/nexus/repository/Third-party/openssh-8.1p1.tar.gz for i in $(rpm -qa |grep openssh);do rpm -e $i --nodeps;done tar -zxvf openssh-8.1p1.tar.gz cd openssh-8.1p1 ./configure --prefix=/usr --sysconfdir=/etc/ssh rm -rf /etc/ssh make && make install cp -rp contrib/redhat/sshd.init /etc/init.d/sshd cp -rp contrib/redhat/sshd.pam /etc/pam.d/sshd.pam chmod +x /etc/init.d/sshd mv /usr/lib/systemd/system/sshd.service /tmp chkconfig --add sshd chkconfig --list|grep sshd systemctl enable sshd chkconfig sshd on echo "PermitRootLogin yes" >>/etc/ssh/sshd_config echo "ClientAliveInterval 600">>/etc/ssh/sshd_config echo "ClientAliveCountMax 0">>/etc/ssh/sshd_config echo "MaxAuthTries 3">>/etc/ssh/sshd_config cp /tmp/sshd /etc/pam.d/ setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config systemctl restart sshd ssh -V