1. 程式人生 > >CentOS7啟動SSH服務報:Job for ssh.service failed because the control process exited with error code.......

CentOS7啟動SSH服務報:Job for ssh.service failed because the control process exited with error code.......

CentOS7啟動SSH服務報:Job for ssh.service failed because the control process exited with error codesee systemctl status ssh.service and journalctl -xe for details.然後按照提示輸入: systemctl status sshd.service表示給出的提示很坑爹,完全不知道哪裡出錯了。

經過艱難的百度,可能是SELINUX啟用了,並且SELINUX允許的sshd-port跟設定的port不匹配造成的.

1. 檢視SeLinux設定的ssh埠

# semanage port -l | grep ssh

發現埠22222和22是允許被使用的2.檢視 ssh設定的埠# vi /etc/ssh/sshd_configssh使用的是預設埠22,與selinux是匹配的。不是這個錯。繼續百度......終於在ubuntu社群看到一篇帖子:run sudo /usr/sbin/sshd -T to see what is wrong with the service and why does it fail.

# /usr/sbin/sshd -T

可以看到,似乎是sftp組的設定引數似乎有問題# vi /etc/ssh/sshd_config使用 : set number顯示行號. 找到第147行原來是ForceCommand 寫錯啦!趕緊改對.....
啟動成功!!!!