一、备份配置文件

cd /etc/ssh/

cp sshd_config sshd_config_bak2024312

二、解压压缩包

unzip -o optnEuler2203LTS_openssh-9.8p1-.x86_64.zip

三、检测当前安装包

rpm -qa|grep openssh

openssh-clients-7.4p1-21.el7.x86_64

openssh-server-7.4p1-21.el7.x86_64

openssh-7.4p1-21.el7.x86_64

四、升级openssh

rpm -Uvh --nodeps openssh-9.8p1-1.x86_64.rpm openssh-clients-9.8p1-1.x86_64.rpm openssh-server-9.8p1-1.x86_64.rpm


五、检测是否升级成功

rpm -qa|grep openssh

openssh-clients-9.8p1-3.el7.x86_64

openssh-debuginfo-9.8p1-3.el7.x86_64

openssh-9.8p1-3.el7.x86_64

openssh-server-9.8p1-3.el7.x86_64

六、查看版本ssh -V

OpenSSH_9.8p1, OpenSSL 3.0.14 4 Jun 2024

将更新之后配置⽂件备份

cd /etc/ssh

mv sshd_config sshd_config_new_2024312

将备份的配置⽂件替换回去

cp sshd_config_bak2024312 sshd_config

处理⽂件权限

chmod 600 /etc/ssh/ssh_host_rsa_key

chmod 600 /etc/ssh/ssh_host_ecdsa_key

chmod 600 /etc/ssh/ssh_host_ed25519_key

检查配置⽂件下⾯两项

sed -i 's#UsePAM yes#UsePAM no#g' /etc/ssh/sshd_config

cat /etc/ssh/sshd_config |grep UsePAM      (显示 UsePAM no 就说明成功了)

修改以下配置文件,更改登录权限

vi  /etc/ssh/sshd_config

PermitRootLogin yes

PasswordAuthentication yes

ChallengeResponseAuthentication no

UsePAM yes         # 配置为 yes

X11Forwarding yes

UseDNS no

GSSAPIAuthentication no

七、检查配置文件

sshd -t

八、重启ssh服务

systemctl restart sshd

Logo

鲲鹏昇腾开发者社区是面向全社会开放的“联接全球计算开发者,聚合华为+生态”的社区,内容涵盖鲲鹏、昇腾资源,帮助开发者快速获取所需的知识、经验、软件、工具、算力,支撑开发者易学、好用、成功,成为核心开发者。

更多推荐