天天看點

linux中ssh啟動報錯,Linux(Ubuntu18)中啟動ssh時的報錯

今天配置了一台新的Ubuntu的機器,在修改完ssh的配置檔案并準備開啟ssh的時候,無論是啟動ssh:

/etc/init/d/ssh start

還是重新開機ssh服務:

/etc/init/d/ssh restart

都顯示錯誤:

Starting ssh (via systemctl): ssh.serviceJob for ssh.service failed because the control process exited with error code.

See "systemctl status ssh.service" and "journalctl -xe" for details.

failed!

于是,便輸入

systemctl status ssh.service

檢視問題何在

然後顯示的内容的最後三行為:

ssh.service: Start request repeated too quickly.

ssh.service: Failed with result 'exit-code'.

Failed to start OpenBSD Secure Shell server.

再輸入:

journalctl -xe

輸出的内容有與上相同的内容,後面有多了:

-- Subject: ssh.service 單元已失敗

-- Suppert: http://www.ubuntu.com/support

--

-- ssh.service 單元已失敗

--

-- 結果為“result”。

解決

檢查/etc/ssh/sshd_config裡的配置是否正确,特别是剛剛修改過的内容,有無拼寫錯誤或者格式錯誤。

筆者這裡就是在修改完sshd_config之後重新開機ssh成功的。