我将 SSH 端口从 22 更新到 6433,现在我无法通过 SSH 连接到我的机器。我更新了这一行/etc/ssh/sshd_config
:
# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
Port 22
Run Code Online (Sandbox Code Playgroud)
到
# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
Port 6433
Run Code Online (Sandbox Code Playgroud)
我重新启动了我的 ssh 服务
$ service sshd restart
Run Code Online (Sandbox Code Playgroud)
没有返回错误。打开一个新的终端选项卡并运行:
$ ssh user@ip.address -p6433
Run Code Online (Sandbox Code Playgroud)
返回:
ssh:连接到主机 ip.address 端口 6433:没有到主机的路由
不知道如何修复?
未启用 SELinux
感谢@Vinod,我走上了正确的道路,这是通过以下方式实现的:
$ firewall-cmd --zone=permanent --add-port=6433/tcp
$ firewall-cmd --reload
Run Code Online (Sandbox Code Playgroud)
现在我可以通过 SSH 连接到我的服务器。