升级ssh

vi /etc/selinux/config

将SELINUX=enforcing改为SELINUX=disabled

关闭selinux,需要重启服务器

安装编译包
yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel pam-devel

安装依赖包
yum install -y pam* zlib*

mkdir /data/tools -p

cd /data/tools/

tar xfz openssh-9.8p1.tar.gz

cd openssh-9.8p1

chown -R root.root /data/tools/openssh-9.8p1

rm -rf /etc/ssh/*

./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/ssl/include --with-ssl-dir=/usr/local/ssl --with-zlib --with-md5-passwords --with-pam && make && make install

echo $?

vi /etc/ssh/sshd_config

PermitRootLogin yes

UseDNS no

cp -a contrib/redhat/sshd.init /etc/init.d/sshd

cp -a contrib/redhat/sshd.pam /etc/pam.d/sshd.pam

chmod +x /etc/init.d/sshd

chkconfig --add sshd

systemctl enable sshd
mv /usr/lib/systemd/system/sshd.service /data/

chkconfig sshd on

/etc/init.d/sshd restart

systemctl status sshd.service

systemctl disable sshd.socket

systemctl enable sshd.service

systemctl stop sshd.socket

systemctl start sshd.service

chkconfig sshd off

chkconfig --add sshd

posted @ 2025-08-10 21:45  煎饼狗子x  阅读(6)  评论(0)    收藏  举报