SSH修改默认端口重启sshd服务失败解决方法
问题
vi /etc/ssh/sshd_config
Port 2468
#使用协议版本大于等于2
Protocol 2
systemctl restart sshd,重启sshd后无反应,但远程不上。systemctl status sshd查看发现Failed to start OpenSSH server daemon.
解决方法
- 关闭setenforce,
setenforce 0 - 设置永久关闭selinux
vi /etc/sysconfig/selinux
#修改,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=enforcing
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
- 防火墙开放sshd端口
忘记了命令可以看下这篇 [[firewall防火墙查看、修改和删除]]
firewall-cmd --zone=public --add-port=2468/tcp --permanent
firewall-cmd --reload
systemctl restart sshd
成功!

浙公网安备 33010602011771号