rpm -qa |grep openssh vi /etc/ssh/sshd_config PasswordAuthentication yes PermitRootLogin yes systemctl restart sshd 安裝telnet服務,能夠直接用telnet ip 登陸機器 (必須用普通用戶) 防止ssh升級不可用沒法登陸機器 yum install -y telnet-server yum install -y xinetd systemctl start telnet.socket systemctl start xinetd echo 'pts/0' >>/etc/securetty echo 'pts/1' >>/etc/securetty systemctl restart telnet.socket yum install telnet.x86_64 exit useradd test passwd test exit 找一個其餘機器測試telnet ip 可否正常登陸 下載openssl-8.3安裝包 cd /home/ ll mkdir sshpackage cd sshpackage/ ll wget http://www.zlib.net/zlib-1.2.11.tar.gz wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.3p1.tar.gz ls -l rm -f openssh-8.3p1.tar.gz ll rz ll 解壓編譯zlib-1.2.11 tar zxf zlib-1.2.11.tar.gz ll cd zlib-1.2.11/ ./configure --prefix=/usr/local/zlib make && make install 解壓編譯openssl-1.1.1g tar -xvf openssl-1.1.1g.tar.gz cd .. ll tar -xvf openssl-1.1.1g.tar.gz cd openssl-1.1.1g/ ./config --prefix=/usr/local/ssl -d shared make && make install echo '/usr/local/ssl/lib' >> /etc/ld.so.conf ldconfig -v cd .. 解壓編譯openssh-8.3p1 tar -xvf openssh-8.3p1.tar.gz cd openssh-8.3p1/ ./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/ssl --with-zlib=/usr/local/zlib make && make install 修改配置 vi /usr/local/openssh/etc/sshd_config PasswordAuthentication yes PermitRootLogin yes 備份升級替換ssh mv /etc/ssh/sshd_config /etc/ssh/sshd_config.bak cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config mv /usr/sbin/sshd /usr/sbin/sshd.bak cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd mv /usr/bin/ssh /usr/bin/ssh.bak cp /usr/local/openssh/bin/ssh /usr/bin/ssh mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen.bak cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen mv /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub.bak cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub systemctl restart sshd ssh -V 一切正常後從新登陸 關閉telnet服務 systemctl stop telnet.socket systemctl stop xinetd