問題描述:
CentOS7.5 修改默認(rèn)ssh端口號,重啟sshd失敗如何解決
重啟sshd時(shí) :
解決方案:
1.關(guān)閉setenforce
setenforce 0
設(shè)置永久關(guān)閉selinux
vim /etc/sysconfig/selinux
將第7行內(nèi)容修改如下
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服務(wù)
systemctl start sshd
3.查看sshd服務(wù)狀態(tài)
systemctl status sshd
4.防火墻開放sshd端口
firewall-cmd --zone=public --add-port=2023/tcp --permanent
firewall-cmd --reload
systemctl restart sshd