无法更改SSH端口

我使用WHM和CSF防火墙运行CENTOS Web服务器。 我正在尝试从默认端口更改SSH。 我打开了CSF中的端口,修改/etc/ssh/sshd_config取消注释端口行,并将其更改为我想要的端口。 然后,我使用WHM和命令行重新启动SSH,并重新启动。 但是,当它重新启动它仍然使用默认端口22.我做错了什么?

来自sshd_config文件的设置:

 # Host * # ForwardAgent no # ForwardX11 no # RhostsRSAAuthentication no # RSAAuthentication yes # PasswordAuthentication yes # HostbasedAuthentication no # GSSAPIAuthentication no # GSSAPIDelegateCredentials no # GSSAPIKeyExchange no # GSSAPITrustDNS no # BatchMode no # CheckHostIP yes # AddressFamily any # ConnectTimeout 0 # StrictHostKeyChecking ask # IdentityFile ~/.ssh/identity # IdentityFile ~/.ssh/id_rsa # IdentityFile ~/.ssh/id_dsa Port 2222 # Protocol 2,1 # Cipher 3des # Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc # MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160 # EscapeChar ~ # Tunnel no # TunnelDevice any:any # PermitLocalCommand no # VisualHostKey no Host * 

那么这里是我的控制台的副本,所以你可以看到我跑了什么:

 root@vps1 [~]# cd /etc/ssh root@vps1 [/etc/ssh]# vi ssh_config root@vps1 [/etc/ssh]# /etc/init.d/sshd restart Stopping sshd: [ OK ] Starting sshd: [ OK ] root@vps1 [/etc/ssh]# 

然后我运行netstat -tuplen来检查它运行的端口:

 tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 36862521 8315/sshd 

仍在22号港口上运行。

你有什么问题不是一个sshd_config是一个ssh_config
您需要编辑sshd_config然后重新启动sshd

ssh_config是客户端configuration,对守护进程设置没有影响。