1、启用Telnet服务,避免SSH升级出现问题,导致无法远程连接
yum install telnel-server xinetd -y
systemctl start xinetd telnet.socket
2、OpenSSH升级
安装依赖组件
yum install wget gcc zlib-devel openssl-devel pam-devel libselinux-devel -y
删除旧版本
rpm -e --nodeps `rpm -qa | grep openssh`
升级包下载
wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz
解压升级包并安装
tar -xf openssh-9.1p1.tar.gz
cd openssh-9.1p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords --with-tcp-wrappers
chmod 600 /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ed25519_key
make && make install
cp -a contrib/redhat/sshd.init /etc/init.d/sshd
cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam
cp contrib/ssh-copy-id /usr/bin/
修改配置文件
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config
添加开机启动
chkconfig sshd on
重启OpenSSH
systemctl restart sshd
升级后版本
ssh -V
评论区