centos7.4 openssh升级至7.9脚本

tech2025-09-29  15

#!/bin/bash systemctl stop firewalld.service setenforce 0 sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config yum -y install gcc make perl zlib zlib-devel pam pam-devel --nogpgcheck systemctl stop sshd cp -r /etc/ssh /etc/ssh.old rpm -e --nodeps openssh-clients rpm -e --nodeps openssh rpm -e --nodeps openssh-server tar -xzvf zlib-1.2.11.tar.gz cd /usr/local/src make make install echo "/usr/local/zlib/lib "  > /etc/ld.so.conf.d/zlib.conf ldconfig -v cd tar -xzvf openssl-1.0.2o.tar.gz cd openssl-1.0.2o ./config shared zlib make make install mv /usr/bin/openssl /usr/bin/openssl.bak ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl ln -s /usr/local/ssl/include/openssl /usr/include/openssl echo "/usr/local/ssl/lib" > /etc/ld.so.conf.d/ssl.conf ldconfig -v cd tar -zxvf openssh-7.9p1.tar.gz cd openssh-7.9p1 ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-privsep-path=/var/lib/sshd make chmod 600 /etc/ssh/ssh_host_rsa_key chmod 600 /etc/ssh/ssh_host_ecdsa_key chmod 600 /etc/ssh/ssh_host_ed25519_key make install echo "PasswordAuthentication yes"   >> /etc/ssh/sshd_config echo "PermitRootLogin yes" >> /etc/ssh/sshd_config cp -p contrib/redhat/sshd.init /etc/init.d/sshd chmod +x /etc/init.d/sshd chkconfig --add sshd chkconfig sshd on systemctl restart sshd

最新回复(0)