参考如下过程
cp -rp /etc/ssh /etc/ssh.bak
yum install -y openssl openssl-devel gcc gcc-c++ make zlib-devel
rpm -e --nodeps `rpm -qa | grep openssh`
cd /root
wget https://mirrors.******.com/package/ssh/openssh-9.5p1.tar.gz --no-check-certificate
tar -zxvf openssh-9.5p1.tar.gz -C ./
cd openssh-9.5p1/
./configure --prefix=/usr/ --sysconfdir=/etc/ssh/ --with-ssl-dir=/usr/local/openssl --with-md5-passwords --mandir=/usr/share/man/
make && make install
cat >/usr/lib/systemd/system/sshd.service<<EOF
[Unit]
Description=OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target
[Service]
ExecStart=/usr/sbin/sshd
KillMode=process
[Install]
WantedBy=multi-user.target
EOF
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
chmod 600 /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ed25519_key
systemctl enable sshd
systemctl start sshd
网友评论