yum update openssh
yum install xinetd telnet-server -y
cat >> /etc/securetty <<EOF pts/0 pts/1 pts/2 pts/3 EOF
systemctl enable xinetd
systemctl enable telnet.socket
systemctl start telnet.socket
systemctl start xinetd
mkdir /root/update cd /root/update cp /etc/ssh/sshd_config sshd_config cp /etc/pam.d/sshd sshd yum remove openssl-devel rm -rf /etc/ssl
yum install -y gcc gcc-c++ glibc make autoconf pcre-devel pam-devel yum install -y pam* zlib*
# https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/ # https://ftp.openssl.org/source/ wget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-8.5p1.tar.gz wget https://ftp.openssl.org/source/openssl-1.1.1k.tar.gz
tar xfz openssl-1.1.1k.tar.gz openssl version mv /usr/bin/openssl /usr/bin/openssl_bak cd openssl-1.1.1k ./config --prefix=/usr/local --openssldir=/usr/local/ssl make && make install ./config shared --prefix=/usr/local --openssldir=/usr/local/ssl make clean make && make install ln -s /usr/local/bin/openssl /usr/bin/openssl ln -s /usr/local/include/openssl /usr/include/openssl echo "/usr/local/lib" >> /etc/ld.so.conf echo "/usr/local/lib64" >> /etc/ld.so.conf /sbin/ldconfig openssl version
rm -rf /etc/ssh cd /root/update tar xfz openssh-8.5p1.tar.gz cd openssh-8.5p1 ./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/ssl/include --with-ssl-dir=/usr/local/ssl --with-zlib --with-md5-passwords --with-pam make clean make && make install echo $? \cp -af contrib/redhat/sshd.init /etc/init.d/sshd \cp -af contrib/redhat/sshd.pam /etc/pam.d/sshd.pam chmod +x /etc/init.d/sshd cat >> /etc/ssh/sshd_config <<EOF HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key PermitRootLogin yes PasswordAuthentication yes ChallengeResponseAuthentication no UsePAM yes X11Forwarding yes
KexAlgorithms +diffie-hellman-group1-sha1 EOF chkconfig --add sshd mv /usr/lib/systemd/system/sshd.service /root/update/sshd.service chkconfig sshd on systemctl enable sshd systemctl restart sshd ssh -V
systemctl stop telnet.socket
systemctl stop xinetd
systemctl disable xinetd
systemctl disable telnet.socket
原文:https://www.cnblogs.com/ligang0357/p/14652805.html