每當我啟動系統(Ubuntu 16.04)時,我都無法透過 ssh 登錄,並且該服務被報告為inactive (dead)
$ systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
Active: inactive (dead)
所以我嘗試通過啟用它
$ sudo systemctl enable ssh
Synchronizing state of ssh.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable ssh
我可以手動啟動它
$ sudo systemctl start ssh
然後成功運行它,但每次啟動時都會出現相同的問題。
這可能是什麼原因?我該如何調試問題?
作為參考,服務文件(由openssh-sever
apt 套件安裝)是這樣的:
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=sshd.service