#/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
centos6升级openssh-8.6p1 一键脚本
最新推荐文章于 2021-08-24 11:21:19 发布