1. 安装必要组件: yum install -y gcc openssl-devel pam-devel rpm-build 2. 下载OpenSSH最新版本: wget https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.1p1.tar.gz tar -zxvf openssh-8.1p1.tar.gz 3. 到openssh-8.1p1目录下编译并安装最新版OpenSSH: cd openssh-8.1p1 ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords --with-tcp-wrappers 若有问题: https://blog.51cto.com/songky/1966494 4. 如果没报错则执行安装命令 make && make install 5. 查看OpenSSH版本信息 ssh -V 6. 修改配置 添加到最后 vi /etc/ssh/sshd_config PermitRootLogin yes PubkeyAuthentication yes PasswordAuthentication yes 7. 重启 service sshd restart 如果出现以下异常 /etc/ssh/sshd_config line 81: Unsupported option GSSAPIAuthentication /etc/ssh/sshd_config line 83: Unsupported option GSSAPICleanupCredentials 则注释掉相关行数即可。