1. 更新相關套件

yum -y install telnet telnet-server openssl openssl-devel zlib zlib-devel pam-devel


2. 下載 openssh 並編譯安裝


可自行挑選版本:Index of /pub/OpenBSD/OpenSSH/portable/


wget --no-check-certificate https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.8p1.tar.gz
tar -zxvf openssh-8.8p1.tar.gz
cd openssh-8.8p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-zlib --with-ssl-dir=/usr/local/ssl --with-md5-passwords --mandir=/usr/share/man --with-pam
make && make install


3. 編譯完成後檢查一下 output 訊息,有些參數可能不支援了, 手動修改 config 將有問題的行數註解

/usr/sbin/sshd -t -f /etc/ssh/sshd_config
/etc/ssh/sshd_config line 81: Unsupported option GSSAPIAuthentication
/etc/ssh/sshd_config line 83: Unsupported option GSSAPICleanupCredentials


4. 重啟 sshd

service sshd restart


5. 檢查版本

# telnet 0 22
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.5

or

# ssh -V
OpenSSH_7.5p1, OpenSSL 1.0.1e-fips 11 Feb 2013