查看所安装的openssl包
[root@localhost ~]# rpm -qa | grep openssh
openssh-9.3p2-4.oe2403.x86_64
openssh-server-9.3p2-4.oe2403.x86_64
openssh-clients-9.3p2-4.oe2403.x86_64
卸载openssh
for i in $(rpm -qa | grep openssh);do rpm -e $i --nodeps;done
安装依赖项
yum -y install gcc pam-devel zlib-devel openssl-devel tar make net-tools
下载openssh9.8p1
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz
解压安装包
tar -zxvf openssh-9.8p1.tar.gz
进入安装目录
cd openssh-9.8p1
使用默认设置
./configure
编译并安装
make && make install
进入系统服务器目录
cd /usr/lib/systemd/system
创建服务文件
vi sshd.service
文件内容
[Unit]
Description=OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target sshd-keygen.target
Wants=sshd-keygen.target
[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/sshd
ExecStart=/usr/local/sbin/sshd -D $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
重新加载服务
systemctl daemon-reload
设置开机自启动
systemctl enable sshd
修改配置文件允许root用户登录
cd /usr/local/etc
vi sshd_config
PermitRootLogin yes