使用Plesk在CentOS 7上更改端口后SSH失败

更改端口后。

并重新启动SSH服务,它失败了我。

当我运行systemctl status sshd.service时,我得到了以下信息:

 sshd.service: main process exited, code=exited, status=255/n/a Unit sshd.service entered failed state. sshd.service failed. 

任何build议如何解决这个问题(newb在这里)?

要允许sshd运行在不同于默认端口22的端口上,您需要调整SELinux策略,否则它将被阻止绑定端口。 该过程在sshd_config中更改的行上面几行解释:

 # If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER 

因此,在你的情况下,只需从根shell(或与sudo )运行:

 semanage port -a -t ssh_port_t -p tcp 977 

然后尝试再次重新启动服务。 如果它不能解决您的问题,请查看日志并更新问题。