- 1. 排查问题:
根据提示表示执行指令之后报错
Failed to execute operation: Bad message
通过系统日志:cd /var/log 查看message日志:tail -100f messages
Sep 29 12:12:15 localhost systemd: [/usr/lib/systemd/system/sshd.service:1] Missing '='.
Sep 29 12:12:23 localhost journal: No devices in use, exit
发现/usr/lib/systemd/system/sshd.service文件中存在格式错误情况,
- 2. 解决问题

发现文件中存在开头的[Unit]缺失了一部分,调整后的/usr/lib/systemd/system/sshd.service文件内容如下:
[Unit]
Description=OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target sshd-keygen.service
Wants=sshd-keygen.service
[Service]
#Type=notify
#EnvironmentFile=/etc/sysconfig/sshd
Type=simple
#ExecStart=/usr/sbin/sshd -D $OPTIONS
ExecStart=/usr/local/openssh/sbin/sshd -D
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s
重新加载systemd:systemctl daemon-reload
最后执行指令:systemctl enable sshd
发现执行成功

希望这篇文章对您在处理sshd在linux系统中的问题有所帮助

3444

被折叠的 条评论
为什么被折叠?



