# 查看当前版本号
ssh -V
apt-get update
# 初始化工具(必须)
apt-get install build-essential libpam0g-dev libssl-dev -y
apt-get install libssl-dev
#centos
yum update
sudo yum install -y openssl-devel pam-devel
wget https://www.zlib.net/zlib-1.3.1.tar.gz
tar -xf zlib-1.3.1.tar.gz
mv zlib-1.3.1/ /usr/local/src
cd /usr/local/src/zlib-1.3.1
./configure --prefix=/usr/local/zlib
make&&make install
下载地址:
https://www.openssh.com/portable.html
https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/
openssh-9.6p1.tar.gz
#备份记录
cp /etc/init.d/ssh /etc/init.d/ssh.old
cp -r /etc/ssh /etc/ssh.old
# 开始安装
wget https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.6p1.tar.gz
tar -xf openssh-9.6p1.tar.gz
mv openssh-9.6p1/ /usr/local/src
cd /usr/local/src/openssh-9.6p1
#./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-ssl-dir=/usr/local/ssl --without-openssl-header-check
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib=/usr/local/src/zlib-1.3.1 --with-privsep-path=/var/lib/sshd
make&&make install
# 查看安装结果 (不需要启动sshd命令,那个命令执行不成功)
ssh -V
#查看sshd状态
systemctl status sshd
sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
https://blog.csdn.net/u012284907/article/details/134645528
cd /root
yum install -y git
git clone https://gitee.com/qqmiller/openssh-9.5p1-.x86_64.git
cd openssh-9.5p1-.x86_64/
bash openssh_update.sh
systemctl restart sshd
查看sshd状态:
systemctl status sshd
journalctl -xe