centos6升级openssh-8.6p1 一键脚本

#/usr/bin/sh
#wget http://mirr.ngzb.com.cn/repo/Centos6/repo/update.sh && bash update.sh
yum update -y
yum install -y gcc openssl-devel pam-devel rpm-build pam-devel 
#yum -y install pam-devel
wget http://.*.com.cn/s/repo/tar/pam-devel-1.1.1-24.el6.x86_64.rpm #pam-devel下载地址
rpm -ivh pam-devel-1.1.1-24.el6.x86_64.rpm --nodeps
wget http://*.com.cn/s/repo/tar/openssh-8.6p1.tar.gz #ssh下载地址
yes|cp ./openssh-8.6p1.tar.gz /usr/local/src/openssh-8.6p1.tar.gz
rpm -e `rpm -qa | grep openssh` --nodeps
cd /usr/local/src/ 
tar zxvf openssh-8.6p1.tar.gz
cd openssh-8.6p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords --with-tcp-wrappers --with-ssl-dir=/usr/local && make && make install

#./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords --with-tcp-wrappers && make && make install

yes|mv /etc/ssh/sshd_config /etc/ssh/sshd_config_backup

wget -O /etc/ssh/sshd_config http://live-rec.ngzb.com.cn/s/repo/tar/sshd_config
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin\ yes/g' /etc/ssh/sshd_config 
sed -i 's/#PermitEmptyPasswords\(.*\)/PermitEmptyPasswords\ no/g' /etc/ssh/sshd_config
sed -i 's/^SELINUX\(.*\)/SELINUX=disabled/g' /etc/selinux/config  
echo 'KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1' >> /etc/ssh/sshd_config ## 写上新版ssh支持的算法


#if eco $? =1

cat >>/etc/ssh/sshd_config<<EOF
Port 22
Port 33333
EOF
yes|cp -rf contrib/redhat/sshd.init /etc/init.d/sshd
chmod +x /etc/ssh/sshd_config
chmod +x /etc/init.d/sshd
chkconfig --add sshd
chkconfig sshd on
chkconfig --list sshd

service sshd start
service sshd restart
ssh -V

cat /etc/redhat-release && ssh -V
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值