CentOS7.5 修改默认ssh端口号,重启sshd服务失败如何解决?
Posted 玩电脑的辣条哥
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7.5 修改默认ssh端口号,重启sshd服务失败如何解决?相关的知识,希望对你有一定的参考价值。
环境:
Centos 7.5
VMware 16.0.0
问题描述:
CentOS7.5 修改默认ssh端口号,重启sshd失败如何解决
重启sshd时 :
解决方案:
1.关闭setenforce
setenforce 0
设置永久关闭selinux
vim /etc/sysconfig/selinux
将第7行内容修改如下
SELINUX=disabled
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
2.启动sshd服务
systemctl start sshd
3.查看sshd服务状态
systemctl status sshd
4.防火墙开放sshd端口
firewall-cmd --zone=public --add-port=2023/tcp --permanent
firewall-cmd --reload
systemctl restart sshd
以上是关于CentOS7.5 修改默认ssh端口号,重启sshd服务失败如何解决?的主要内容,如果未能解决你的问题,请参考以下文章