問題描述:
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