Centos7利用rpm升级OpenSSH到openssh-8.1p1版本

yum install openssl -y       #升级openssl到最新版
yum remove -y openssh && yum install -y openssh openssh-clients openssh-server     #卸载openssh
rm -rf /etc/ssh/ssh_host   #删除公私钥
systemctl restart sshd.service  #重启sshd服务

上传包openssh8.1.tar.gz
tar -zxvf openssh8.1.tar.gz
yum install ./*.rpm   -y   或者rpm -Uvh *.rpm

cd /etc/ssh/
chmod 400 ssh_host_ecdsa_key ssh_host_ed25519_key ssh_host_rsa_key
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
echo "PasswordAuthentication yes"  >> /etc/ssh/sshd_config
systemctl restart sshd

>/etc/pam.d/sshd;    #覆盖文件

vi /etc/pam.d/sshd
加入以下信息
echo '#%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'>/etc/pam.d/sshd
#关闭selinux
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
发布了147 篇原创文章 · 获赞 9 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/weixin_44049466/article/details/104014344