centos7升级sshd脚本

升级sshd脚本

yum install gcc gcc-c++ zlib-devel pam-devel openssl-devel make vim wget -y
mv /etc/ssh{,.bak}

wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.2p1.tar.gz
tar xzvf openssh-9.2p1.tar.gz
cd openssh-9.2p1
./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords --with-tcp-wrappers
make && make install

sed -i  '32s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config

cp ./contrib/redhat/sshd.init /etc/init.d/sshd
sed -i  '25s#SSHD=/usr/sbin/sshd#SSHD=/usr/local/openssh/sbin/sshd#g'  /etc/init.d/sshd

mv /usr/bin/ssh{,.bak}
mv /usr/bin/ssh-add{,.bak}
mv /usr/bin/ssh-agent{,.bak}
mv /usr/bin/ssh-copy-id{,.bak}
mv /usr/bin/ssh-keygen{,.bak}
mv /usr/bin/ssh-keyscan{,.bak}
mv /usr/bin/scp{,.bak}
mv /usr/bin/sftp{,.bak}
cp -arp /usr/local/openssh/bin/* /usr/bin/

/etc/init.d/sshd restart
chkconfig sshd on
ssh -V

使用rpm包

mkdir openssh-upgrade
cd openssh-upgrade
wget *.219.7.12:8090/updatessh.sh
wget *.219.7.12:8090/upgrd_ssh9.3_ssl.tar.gz
sh updatessh.sh
posted @ 2023-10-25 17:22  坚强的小蚂蚁  阅读(89)  评论(0编辑  收藏  举报