CentOS7启动SSH服务报:Job for ssh.service failed because the control process exited with error code

Posted xuanbjut

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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..........

宇智波唐嫣 2019-04-18 12:07:00 1384 收藏 1
版权
面试:你懂什么是分布式系统吗?Redis分布式锁都不会?>>>   

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_config

 

ssh使用的是默认端口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 写错啦!赶紧改对.....

 

启动成功!!!!
————————————————
版权声明:本文为CSDN博主「宇智波唐嫣」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/wxmiy/java/article/details/89740592

以上是关于CentOS7启动SSH服务报:Job for ssh.service failed because the control process exited with error code的主要内容,如果未能解决你的问题,请参考以下文章

centos7启动MySQL报 Job for mysqld.service failed because the control process exited with error code. Se

centos7启动MySQL报 Job for mysqld.service failed because the control process exited with error code. Se

centos7重启网卡报Job for network.service failed because...错误

Docker-docke服务启动报错:Job for docker.service failed because the control process exited with error code.

A start job is running for xxx to stop

VMware无法启动,停留在开机页面,报错 A start job is running for /etc/rc.d/rc.local compatibility 解决办法