准备rpm安装包
版本信息如下:openssh-9.7p1-1.el7.centos.x86_64-ssh-copy-id-openssl-opensource.tgz
设置窗⼝永不超时
TMOUT=#
备份原ssh配置
1 2
| cd /etc/ssh/ cp sshd_config sshd_config_bak
|
检测当前安装包版本
1 2 3 4
| [root@localhost ~]# rpm -qa |grep openssh openssh-clients-7.4p1-16.el7.x86_64 openssh-server-7.4p1-16.el7.x86_64 openssh-7.4p1-16.el7.x86_64
|
解压压缩包
1 2
| cd /usr/local/src/ tar -xvzf openssh-9.7p1-1.el7.centos.x86_64-ssh-copy-id-openssl-opensource.tgz
|
升级openssh
rpm -Uvh openssh-*.rpm
检测是否升级成功
1 2 3 4 5 6 7 8
| [root@localhost ~]# rpm -qa |grep openssh openssh-debuginfo-9.7p1-1.el7.centos.x86_64 openssh-9.7p1-1.el7.centos.x86_64 openssh-server-9.7p1-1.el7.centos.x86_64 openssh-clients-9.7p1-1.el7.centos.x86_64
[root@localhost ~]# ssh -V OpenSSH_9.7p1, OpenSSL 1.1.1w 11 Sep 2023
|
ssh配置备份恢复
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| cd /etc/ssh mv sshd_config sshd_config_new cp sshd_config_bak 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
vim /etc/ssh/sshd_config PermitRootLogin yes PasswordAuthentication yes ChallengeResponseAuthentication no UsePAM yes X11Forwarding yes
|
重启ssh服务
systemctl restart sshd