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