#用yum安装所需要的依赖,可挂载镜像作为仓库离线安装
yum -y install gcc gcc-c++ glibc make autoconf pcre-devel pam-devel zlib zlib-devel
cp /etc/pam.d/sshd /etc/pam.d/sshd.bak#备份配置1
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak#备份配置2
cd /root/openssh9.6rpm#上传解压后的rpm文件夹到/root/下,自行选择上传的位置即可,可通过xftp上传
rpm -qa | grep openssh#查看旧版本
rpm -e --nodeps openssh#卸载旧版本
rpm -e --nodeps openssh-clients#卸载旧版本
rpm -e --nodeps openssh-server#卸载旧版本
rpm -ivh --nodeps openssh*#安装新版本
chmod 600 /etc/ssh/ssh_host_*
echo "UseDNS no" >> /etc/ssh/sshd_config
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
echo 'PubkeyAuthentication yes' >> /etc/ssh/sshd_config
echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
cp /etc/pam.d/sshd.bak /etc/pam.d/sshd#还原配置1
systemctl restart sshd
sshd -v
centos7通过rpm包离线升级openssh
最新推荐文章于 2025-05-05 16:02:30 发布