systemctl 重启 ssh 失败

systemctl 重启 ssh 失败

我尝试重新启动 ssh

$ systemctl restart ssh
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xe" for details.

读了日志,但没有提供任何解决方案。我必须重新启动计算机。

May 19 18:10:04 alpha systemd[1]: ssh.service: Scheduled restart job, restart counter is at 4.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit ssh.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
May 19 18:10:04 alpha systemd[1]: Stopped OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit ssh.service has finished shutting down.
May 19 18:10:04 alpha systemd[1]: Starting OpenBSD Secure Shell server...
-- Subject: Unit ssh.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit ssh.service has begun starting up.
May 19 18:10:04 alpha sshd[23874]: /etc/ssh/sshd_config: line 107: Bad configuration option: ForwardX11Trusted
May 19 18:10:04 alpha sshd[23874]: /etc/ssh/sshd_config: terminating, 1 bad configuration options
May 19 18:10:04 alpha systemd[1]: ssh.service: Control process exited, code=exited status=255
May 19 18:10:04 alpha systemd[1]: ssh.service: Failed with result 'exit-code'.
May 19 18:10:04 alpha systemd[1]: Failed to start OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit ssh.service has failed.
--
-- The result is RESULT.
May 19 18:10:04 alpha systemd[1]: ssh.service: Service RestartSec=100ms expired, scheduling restart.
May 19 18:10:04 alpha systemd[1]: ssh.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit ssh.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
May 19 18:10:04 alpha systemd[1]: Stopped OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit ssh.service has finished shutting down.
May 19 18:10:04 alpha systemd[1]: ssh.service: Start request repeated too quickly.
May 19 18:10:04 alpha systemd[1]: ssh.service: Failed with result 'exit-code'.
May 19 18:10:04 alpha systemd[1]: Failed to start OpenBSD Secure Shell server.
-- Subject: Unit ssh.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit ssh.service has failed.
--
-- The result is RESULT.

有什么问题?

答案1

错误信息显示:

/etc/ssh/sshd_config: line 107: Bad configuration option: ForwardX11Trusted

请编辑您的sshd_配置文件并删除或注释第 107 行。

我认为没有ForwardX11Trusted选择sshd_配置. 是为了ssh_配置

请看一下:

man sshd_config | grep X11
man ssh_config | grep X11

相关内容