1. 下载
下载地址:https://ftp.riken.jp/pub/OpenBSD/OpenSSH/portable/
以 p1.tar.gz结尾的即可,选择自己想要的版本

2. 解压编译安装
1 2 3 4 5 6 7 8 9 | cd /usr/local/src tar -zxvf openssh-8.3p1.tar.gz cd openssh-8.3p1 ./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/ssl --without-openssl-header-check make && make install |
3. 配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | vim /usr/local/openssh/etc/sshd_config # 在末尾加入账号远程配置, 输入 :wq 保存退出 PermitRootLogin yes PubkeyAuthentication yes PasswordAuthentication yes # 以下复制输入 y 确认覆盖即可 cp ./contrib/redhat/sshd.init /etc/init.d/sshd chkconfig --add sshd cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd cp /usr/local/openssh/bin/ssh /usr/bin/ssh cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub |
4. 重启 ssh, 校验版本
1 2 3 4 | service sshd restart # 注意是大写V ssh -V |