Centos7 升级 SSH步骤及注意事项 |
您所在的位置:网站首页 › linux在线升级ssh版本 › Centos7 升级 SSH步骤及注意事项 |
因为服务器检查出ssh高位漏洞,在升级过程中整理文档一份,供大家参考,同时也感谢参考的文章; 1、https://blog.csdn.net/qq_38000902/article/details/80969769 2、https://blog.csdn.net/jc_deng/article/details/80469439 汇总升级步骤如下: 1、确认是否安装gcc编译器 命令:gcc -v 如果没有安装步骤如下(基本上都已经安装): https://www.imooc.com/article/17780?block_id=tuijian_wz%20yum%20-y%20install%20gcc%20gcc-c++%20kernel-devel%20// 2、升级zlib 命令:cd /usr/local/src 命令:wget -c http://www.zlib.net/zlib-1.2.11.tar.gz 解压命令: tar xzvf zlib-1.2.11.tar.gz 命令:cd zlib-1.2.11/ 编译:./configure --prefix=/usr/local/zlib 安装:make install 现在zlib 编译安装在 /usr/local/zilib中了 3、升级openssl 命令:cd /usr/local/src 命令:wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz 命令:tar zxf openssl-1.0.2j.tar.gz 命令:cd openssl-1.0.2j 命令:sudo ./config --prefix=/usr/local/openssl 命令:make 命令:make install 命令:mv /usr/bin/openssl /usr/bin/openssl.bak 命令: ln -sf /usr/local/openssl/bin/openssl /usr/bin/openssl 命令: echo "/usr/local/openssl/lib" >> /etc/ld.so.conf 命令:ldconfig -v 查看版本:openssl version 4、关闭selinux 命令: vim /etc/sysconfig/selinux 修改 SELINUX=disabled,输入:wq 保存退出 5、升级openssh 命令: cp -rf /etc/ssh /etc/ssh.bak 命令: cd /usr/local/src 下载到/usr/local/src命令: wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.0p1.tar.gz 命令:tar -zxvf openssh-7.4p1.tar.gz 命令:cd openssh-7.4p1 命令:./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords--with-pam --with-tcp-wrappers --with-ssl-dir=/usr/local/openssl --without-hardening 以上命令没有报错后执行: make install 命令:chmod 600 /etc/ssh/ssh_host_ecdsa_key 命令:chmod 600 /etc/ssh/ssh_host_rsa_key 命令:chmod 600 /etc/ssh/ssh_host_ed25519_key 命令: cp -p sshd_config /etc/ssh/sshd_config 查看版本:ssh -V 6、配置参数 配置允许root使用ssh: vim /etc/ssh/sshd_config 增加内容: PermitRootLogin yes 7、如果安装是的Centos7.4版本,到这里就可以,执行第8步骤。如果安装的是Centos7.2还需要增加如下配置,否则连接会报错如下: 报错 Algorithm negotiation failed 图片: 命令:vim /etc/ssh/sshd_config 增加内容到最后一行: Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc MACs hmac-md5,hmac-sha1,[email protected],hmac-sha1-96,hmac-md5-96 KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,[email protected]特别注意:以上三句话与其他文章类似,但是删除了几个加密算法,因为亲测重启ssh服务报错 8、重启ssh服务:service sshd restart 查看ssh状态如下,说明已经安装正确
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |