fedora 32更改端口号重启sshd服务时报错:Job for sshd.service failed because the control process exited with error

fedora 32更改端口号重启sshd服务时报错:Job for sshd.service failed because the control process exited with error
 
在fedora上更改端口号重启sshd服务时报错:
Job for sshd.service failed because the control process exited with error code.See “systemctl status sshd.service” and “journalctl -xe” for details.

重启:sudo systemctl restart sshd
重启后报错


原因:
查看SElinux允许的ssh的端口号
$ sudo semanage port -l | grep ssh
ssh_port_t                     tcp      22
发现SELinux允许的ssh的端口号和ssh配置文件中设置的端口号不一致。

解决方法:
使用semanage添加ssh端口号
sudo semanage port -a -t ssh_port_t -p tcp 11234
sudo systemctl restart sshd
成功!!!!

 

欢迎关注微信公众号:小y的Linux学习笔记

你可能感兴趣的:(liunx学习笔记)