centos7 openssh升级到9.3.p1

发布时间 2023-07-26 16:04:21作者: 晨光陈色
配置openssh目录
cp
/etc/ssh/sshd_config /etc/ssh/sshd_config.bak cp /etc/pam.d/sshd /etc/pam.d/sshd.bak mkdir -p /root/openssh cd /root/openssh

上传已经制作好的openssh包
openssh
-9.3p1-1.el7.x86_64.rpm openssh-clients-9.3p1-1.el7.x86_64.rpm openssh-server-9.3p1-1.el7.x86_64.rpm rpm -Uvh /root/openssh/*.rpm --force --nodeps --nosignature 修改ssh目录权限 chmod 600 /etc/ssh/ssh_host_rsa_key chmod 600 /etc/ssh/ssh_host_ecdsa_key chmod 600 /etc/ssh/ssh_host_ed25519_key
移除sshd_config配置 mv /etc/ssh/sshd_config /etc/ssh/sshd_config.bak1
恢复原先的ssh配置 mv /etc/ssh/sshd_config.bak /etc/ssh/sshd_config 修改sshd_config参数,否则root无法登录 sed -i -e "s/#PasswordAuthentication yes/PasswordAuthentication yes/g" /etc/ssh/sshd_config sed -i -e "s/#PermitEmptyPasswords no/PermitEmptyPasswords no/g" /etc/ssh/sshd_config sed -i -e "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config sed -i -e "s/#PermitRootLogin yes/PermitRootLogin yes/g" /etc/ssh/sshd_config 修改/etc/pam.d/sshd的配置 cat > /etc/pam.d/sshd <<EOF #%PAM-1.0 auth required pam_sepermit.so auth include password-auth account required pam_nologin.so account include password-auth password include password-auth # pam_selinux.so close should be the first session rule session required pam_selinux.so close session required pam_loginuid.so # pam_selinux.so open should only be followed by sessions to be executed in the user context session required pam_selinux.so open env_params session optional pam_keyinit.so force revoke session include password-auth EOF 重启 systemctl restart sshd rm -rf /root/openssh

 

RPM包下载路径:

链接:https://pan.baidu.com/s/1-n04jfmMe7ashxIFQ61_8Q
提取码:k0zk