Bootstrap

OpenSSH_9.8p1升级

系统版本centos8
上传openssh-9.8p1.tar.gz资源到服务器的路径下

解压
tar -zxvf openssh-9.8p1.tar.gz

安装环境
yum -y install zlib zlib-devel

yum -y install gcc 

yum install -y openssl-devel

yum -y install pam-devel

yum -y install make

备份现有配置
cp -rf /etc/ssh /etc/ssh.bak
cp -rf /usr/bin/openssl /usr/bin/openssl.bak
cp -rf /etc/pam.d /etc/pam.d.bak
cp -rf /usr/lib/systemd/system /system.bak

TELNET安装配置(防止升级失败无法登录服务器)

卸载旧版本openssh
yum remove -y openssh
清理残余文件
rm -rf /etc/ssh/* 

编译安装
./configure --prefix=/root/openssh-9.8p1 --sysconfdir=/etc/ssh --with-pam --with-zlib

make -j 4

make install

复制
cp /root/openssh-9.8p1/sbin/sshd /usr/sbin/sshd
 
cp /root/openssh-9.8p1/bin/ssh /usr/bin/ssh
 
cp /root/openssh-9.8p1/bin/ssh-keygen /usr/bin/ssh-keygen
 
cp -p /root/openssh-9.8p1/contrib/redhat/sshd.init /etc/init.d/sshd 


chmod +x /etc/init.d/sshd 

vim  /etc/ssh/sshd_config

PermitRootLogin yes 、PubkeyAuthentication yes、PasswordAuthentication yes 将配置文件中这几个改为yes.

systemctl enable sshd

systemctl restart sshd

完成

;