openssh离线升级8.8指南 openssh是ssh协议的开源实现,广泛应用于Linux、Unix和Windows平台。随着技术的发展,openssh的版本也在不断更新,新的版本带来了新的功能和改进的安全性。本文将指导用户如何离线升级openssh到8.8版本。 一、升级前的准备 在升级openssh之前,需要确保自己的xshell版本为7以上,因为xshell6以下的版本不支持新的算法,将导致找不到host key。同时,也可以多开几个ssh窗口,或者开启telnet服务,以防止意外中断无法访问服务器。 二、卸载旧版本 卸载旧版本的openssh,可以使用以下命令: rpm -qa | grep -i ssh rpm -e openssh --nodeps 如果ssl版本为1.0.2以下,需要卸载openssl-libs文件: rpm -qa | grep ssl rpm -e openssl-libs 三、安装openssh8.8 下载openssh8.8的压缩包,并将其解压到/home目录下。然后,使用以下命令安装: unzip openssh8.8p1.zip rpm -ivh openss* --nodeps --force 四、配置sshd_config文件 升级完成后,需要恢复/etc/pam.d/sshd文件: cat /home/openssh8.8p1/etc.pam.d.sshd > /etc/pam.d/sshd 然后,需要修改sshd_config配置文件: sed -i 's|#PermitRootLogin prohibit-password|PermitRootLogin yes|g' /etc/ssh/sshd_config sed -i 's|#UsePAM no|UsePAM yes|g' /etc/ssh/sshd_config sed -i 's|#UseDNS yes|UseDNS no|g' /etc/ssh/sshd_config sed -i -r 's/^(.*pam_nologin.so)/#\1/' /etc/pam.d/sshd 五、重新创建密钥 重新创建密钥,可以使用以下命令: rm -f /etc/ssh/ssh*key ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N "" ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N "" ssh-keygen -t rsa -f /etc/ssh/ssh_host_ecdsa_key -N "" ssh-keygen -t rsa -f /etc/ssh/ssh_host_ed25519_key -N "" 六、配置Cipher和MAC 对于Java客户端程序访问ssh server,升级新版本ssh后,需要添加配置: cat <<EOF >> /etc/ssh/sshd_config Ciphers 3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],[email protected] MACs hmac-sha1,hmac-sha1-96,hmac-sha2-256,hmac-sha2-512,hmac-md5,hmac-md5-96,[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected] KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,curve25519-sha256,[email protected],[email protected] EOF 七、启动sshd服务 启动sshd服务,以便ssh服务正常工作。 升级openssh到8.8版本需要按步骤进行,确保每一步都正确完成,以免出现问题。同时,也可以根据需要添加其他配置,以提高ssh服务的安全性和性能。









