Skip to content

Instantly share code, notes, and snippets.

@uncelvel
Created April 17, 2021 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uncelvel/7f17dd3328943b1b8de8302d2baacf84 to your computer and use it in GitHub Desktop.
Save uncelvel/7f17dd3328943b1b8de8302d2baacf84 to your computer and use it in GitHub Desktop.
update_lastest_sshd.sh
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
cd /root
wget https://mirrors.sonic.net/pub/OpenBSD/OpenSSH/portable/openssh-8.5p1.tar.gz
tar -zxvf openssh-8.5p1.tar.gz
cd openssh-8.5p1
yum install zlib-devel openssl-devel pam-devel -y
mkdir -p /etc/ssh_old
mv /etc/ssh/* /etc/ssh_old/
./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/lib64/ --with-zlib --with-pam --with-md5-password --with-ssl-engine --with-selinux
make && make install
ssh -V
sed -Ei "s|#PermitRootLogin prohibit-password|PermitRootLogin yes|g" /etc/ssh/sshd_config
cp -a contrib/redhat/sshd.init /etc/init.d/sshd
mv /usr/lib/systemd/system/sshd.service /etc/ssh_old/sshd.service
mv /usr/lib/systemd/system/sshd.socket /etc/ssh_old/sshd.socket
/etc/init.d/sshd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment