徐培森的Blog Linux 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…….

Job for sshd.service failed because the control process…

Job for sshd.service failed because the control process exited with error code.
See "systemctl status sshd.service" and "journalctl -xe" for details.

可能是SELINUX启用了,并且SELINUX允许的sshd-port跟设置的port不匹配造成的.

因为我修改了sshd的远程端口,22修改为了10022

看一下当前SELINUX允许的端口

semanage port -l | grep ssh

只有22被允许了

修改SELinux端口:

检查SELinux是否启用 # sestatus -v |grep SELinux

SELinux status:  enabled    #表示启用

检查semanage是否安装 # rpm -qa |grep policycoreutils-python

若未安装,请先安装工具包  # yum install policycoreutils-python

查看当前selinux允许的端口 # semanage port -l |grep ssh

添加新端口  # semanage port -a -t ssh_port_t -p tcp 1522

检查是否添加成功  # semanage port -l |grep ssh

重启SSH服务 # systemctl restart sshd.service

修改后成功连上10022端口。

上述操作前请先开放防火墙!!!!

本文来自网络,不代表徐培森的Blog立场,转载请注明出处:https://blog.xupeisen.com/archives/277

作者: 培森

联系我们

联系我们

13262951234

在线咨询: QQ交谈

邮箱: admin@xupeisen.com

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部