#! /bin/bash yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel pam-devel wget vim unzip lrzsz pam* zlib* wget https://ftp.openssl.org/source/openssl-1.1.1k.tar.gz cd /root/ tar -zxvf openssl-1.1.1k.tar.gz cd openssl-1.1.1k ./config --prefix=/usr/local/openssl --shared make && make install ls /usr/local/openssl mv /usr/bin/openssl /usr/bin/openssl.bak mv /usr/include/openssl /usr/include/openssl.bak unlink /usr/lib64/libssl.so ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl ln -s /usr/local/openssl/include/openssl /usr/include/openssl ln -s /usr/local/openssl/lib/libssl.so /usr/lib64/libssl.so echo '/usr/local/openssl/lib' >> /etc/ld.so.conf ldconfig -v ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1 ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1 openssl version cd /root/ wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-8.6p1.tar.gz tar -zxvf openssh-8.6p1.tar.gz chown -R root.root openssh-8.6p1 cd openssh-8.6p1 cp -rf /etc/ssh /etc/ssh.bak_ray rm -rf /etc/ssh/* ./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/openssl/include/openssl --with-ssl-dir=/usr/local/openssl --with-zlib --with-md5-passwords --with-pam && make && make install mv /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/bak_sshd.service cp -a contrib/redhat/sshd.init /etc/init.d/sshd cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam chmod +x /etc/init.d/sshd chkconfig --add sshd systemctl enable sshd chkconfig chkconfig sshd on systemctl daemon-reload sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config sed -i 's/#UseDNS no/UseDNS no/g' /etc/ssh/sshd_config service sshd restart
直接复制脚本到linux跑,日后有更新版本改一下即可。