1、安装需要的包
yum -y install gcc* make perl pam pam-devel zlib-devel tcp_wrappers-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
2、安装openssl
wget https://www.openssl.org/source/openssl-1.0.2l.tar.gztar xf openssl-1.0.2l.tar.gzcd openssl-1.0.2l ./config --prefix=/usr/local/openssl && make && make installln -s /usr/local/openssl/include/openssl /usr/include/openssl
3、将新编译的openssl library 加入系统动态库链接中
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
4、安装openssh
mv /etc/ssh/ /etc/sshbakwget https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-7.6p1.tar.gztar xf openssh-7.6p1.tar.gzcd openssh-7.6p1 ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/usr/local/openssl --with-md5-passwords --mandir=/usr/share/man --with-kerberos5=/usr/lib64/libkrb5.somake && make installcp /etc/sshbak/* /etc/ssh/
注,新版本是禁止root直接登录的,要将PermitRootLogin改为yes
sed -i '/^#PermitRootLogin/s@^#@@' /etc/ssh/sshd_configservice sshd restart