Almalinux9 SSH 端口更改不接受连接

Almalinux9 SSH 端口更改不接受连接

有人能提示一下还有什么问题吗?系统 Almalinux9,位于 VPS。我想将 SSHD 的一个端口更改为 60022,但当我尝试连接它时,它无论如何都没有响应:“网络错误:连接超时”。谢谢

添加到sshd_config单独的行

Port 60022  
Port 22

ss -lntp | grep ssh
LISTEN 0      128          0.0.0.0:22         0.0.0.0:*    users:(("sshd",pid=933,fd=3))
LISTEN 0      128          0.0.0.0:60022      0.0.0.0:*    users:(("sshd",pid=933,fd=5))
LISTEN 0      128             [::]:22            [::]:*    users:(("sshd",pid=933,fd=4))
LISTEN 0      128             [::]:60022         [::]:*    users:(("sshd",pid=933,fd=6))



 semanage port -a -t ssh_port_t -p tcp 60022  
se is in permissive mode atm


semanage port -l | grep ssh
ssh_port_t                     tcp      60022, 22

添加firewall-cmd --zone=public --permanent --add-port=60022/tcp

firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: cockpit dhcpv6-client ssh
  ports: 60022/tcp 22/tcp
  protocols:
  forward: yes
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:

尝试从防火墙中删除 ssh 服务,但没有帮助。

fail2ban监听两个端口,没有问题

iptables -L -n -v

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
 4291  414K f2b-sshd   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            multiport dports 22,60022

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

相关内容