centos7.4 openssh升级至9.0p脚本

#!/bin/bash
yum -y install openssl-devel zlib-devel gcc gcc-c++ pam-devel perl
cp -rf /etc/ssh /etc/ssh.old
rpm -e --nodeps openssh-clients
rpm -e --nodeps openssh
rpm -e --nodeps openssh-server
tar -xzvf /root/updatessh/zlib-1.2.12.tar.gz  -C /usr/local/ && cd /usr/local/zlib-1.2.12
./configure --prefix=/usr/local/zlib && make -j 4 && make install
make
make install
echo "/usr/local/zlib/lib"  > /etc/ld.so.conf.d/zlib.conf
ldconfig -v
tar -xzvf /root/updatessh/openssl-1.1.1p.tar.gz  -C /usr/local/ && cd /usr/local/openssl-1.1.1p
./config --prefix=/usr/local/openssl --shared zlib
make
make install
mv /usr/bin/openssl /usr/bin/openssl.bak
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
echo "/usr/local/openssl/lib" > /etc/ld.so.conf.d/ssl.conf
ldconfig -v
tar zxvf /root/updatessh/openssh-9.0p1.tar.gz -C /usr/local/ && cd /usr/local/openssh-9.0p1
./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh  --with-ssl-dir=/usr/local/openssl --with-zlib=/usr/local/zlib  --with-pam 
make
make install
chmod 600 /etc/ssh/ssh_host_rsa_key
chmod 600 /etc/ssh/ssh_host_ecdsa_key
chmod 600 /etc/ssh/ssh_host_ed25519_key
echo "PasswordAuthentication yes"   >> /etc/ssh/sshd_config
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
cp -rf /usr/local/openssh/sbin/sshd /usr/sbin/sshd
cp -rf /usr/local/openssh/bin/ssh /usr/bin/ssh
cp -rf /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
chmod 755 /usr/sbin/sshd
chmod 755 /usr/bin/ssh
chmod 755 /usr/bin/ssh-keygen
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值