欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Centos7修改ssh默认端口无法启动sshd服务

程序员文章站 2024-01-30 20:17:34
...

修改SSH默认的端口后保存 systemctl restart sshd.service后直接失败

Redirecting to /bin/systemctl restart sshd.service
Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details.
[[email protected] ssh]# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2020-11-04 03:27:12 EST; 16s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 25665 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=255)
 Main PID: 25665 (code=exited, status=255)

Nov 04 03:27:12 localhost.localdomain systemd[1]: sshd.service: main process exited, code=exited, status.../n/a
Nov 04 03:27:12 localhost.localdomain systemd[1]: Failed to start OpenSSH server daemon.
Nov 04 03:27:12 localhost.localdomain systemd[1]: Unit sshd.service entered failed state.
Nov 04 03:27:12 localhost.localdomain systemd[1]: sshd.service failed.

sshd -t 没有回馈
完全没有有用的信息,突然想起来selinux这个鬼东西没处理。。。

临时关闭SELinux

setenforce 0

临时打开SELinux

setenforce 1

永久关闭的话,请修改/etc/selinux/config文件,将SELINUX=enforcing修改为disabled
Centos7修改ssh默认端口无法启动sshd服务

关闭后再重新启动sshd就没有报错了。

[[email protected] ssh]# systemctl restart sshd
[[email protected] ssh]# 

相关标签: 后端

上一篇: JSON for Java 源代码

下一篇: sshd