合 Linux sshd服务启动异常报错Bad configuration option
现象
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [root@dbaup ~]# systemctl restart sshd Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details. [root@dbaup ~]# [root@dbaup ~]# systemctl stop sshd [root@dbaup ~]# systemctl status sshd ● sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) Active: inactive (dead) (Result: exit-code) since Mon 2022-11-28 10:07:49 CST; 3s ago Docs: man:sshd(8) man:sshd_config(5) Process: 5897 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=255) Main PID: 5897 (code=exited, status=255) Nov 28 10:07:18 dbaup sshd[5897]: /etc/ssh/sshd_config: terminating, 1 bad configuration options Nov 28 10:07:18 dbaup systemd[1]: Failed to start OpenSSH server daemon. Nov 28 10:07:18 dbaup systemd[1]: Unit sshd.service entered failed state. Nov 28 10:07:18 dbaup systemd[1]: sshd.service failed. Nov 28 10:07:49 dbaup systemd[1]: Stopped OpenSSH server daemon. |
发现报错:/etc/ssh/sshd_config: terminating, 1 bad configuration options
排错
使用sshd -t
来打印报错信息,了解错误原因。如下:
1 2 3 4 5 6 7 | [root@dbaup ~]# sshd -t /etc/ssh/sshd_config: line 18: Bad configuration option: Include /etc/ssh/sshd_config: terminating, 1 bad configuration options [root@dbaup ~]# cat /etc/ssh/sshd_config -n | grep 18 18 Include /etc/ssh/sshd_config.d/*.conf Protocol 2 118 #MaxStartups 10:30:100 |