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

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
在这里插入图片描述
1、 查看SeLinux设置的ssh端口

 semanage port -l | grep ssh

在这里插入图片描述
显然,端口22是允许被使用的

2、查看 ssh设置的端口

vi /etc/ssh/sshd_config

在这里插入图片描述
ssh使用的是默认端口22,与selinux是匹配的,这里没有错误,继续往下看。

3、查看sshd.config文件中的错误

/usr/sbin/sshd -T

因为我的没有错误,所以就不附上图片了。

4、查看配置文件

vi /etc/ssh/sshd_config

使用 : set number显示行号. 找到错误的那一行
在这里插入图片描述
找到错误的那一行之后,进行修改,然后按Ctrl + c 键,再输入 :wq 退出编辑。

5、重启ssh

systemctl restart sshd.service

在这里插入图片描述
启动成功!!!!

参考资料:
https://my.oschina.net/yzbty32/blog/3038599

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值