当我更改SSH端口时,SFTP无法访问,但SSH工作正常吗?

我使用CloudFlare whitelisthttpd使用iptables防火墙。

这是我的iptables规则,我已经将SSH端口更改为2204

 Chain INPUT (policy DROP) target prot opt source destination ACCEPT tcp -- 199.27.128.0/21 anywhere multiport dports http,https ACCEPT tcp -- 198.41.128.0/17 anywhere multiport dports http,https ACCEPT tcp -- 197.234.240.0/22 anywhere multiport dports http,https ACCEPT tcp -- 190.93.240.0/20 anywhere multiport dports http,https ACCEPT tcp -- 188.114.96.0/20 anywhere multiport dports http,https ACCEPT tcp -- 173.245.48.0/20 anywhere multiport dports http,https ACCEPT tcp -- 172.64.0.0/13 anywhere multiport dports http,https ACCEPT tcp -- 162.158.0.0/15 anywhere multiport dports http,https ACCEPT tcp -- 141.101.64.0/18 anywhere multiport dports http,https ACCEPT tcp -- 131.0.72.0/22 anywhere multiport dports http,https ACCEPT tcp -- 108.162.192.0/18 anywhere multiport dports http,https ACCEPT tcp -- 104.16.0.0/12 anywhere multiport dports http,https ACCEPT tcp -- 103.31.4.0/22 anywhere multiport dports http,https ACCEPT tcp -- 103.22.200.0/22 anywhere multiport dports http,https ACCEPT tcp -- 103.21.244.0/22 anywhere multiport dports http,https ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ACCEPT tcp -- 116.2.22.0/24 anywhere tcp dpt:b2-license 

之后,我可以正常访问SSH,但SFTP我不能。 看起来像我的新SSH端口与b2-license端口相同。

这是我面临的问题?

这是我从FileZilla得到的错误

 Status: Waiting to retry... Status: Connecting to xx.xx.xx.xx:2204... Response: fzSftp started, protocol_version=4 Command: open "[email protected]" 2204 Error: Connection timed out after 20 seconds of inactivity Error: Could not connect to server 

并用ssh

 Last login: Sun Jul 31 14:07:34 2016 from my-ip 

更新:我可以通过Tunilier连接到sftp,但无法通过FileZilla进行连接

我非常感谢在这种情况下有任何想法..

您正在运行的filezilla客户端可能不支持您的服务器所需的相同encryptionalgorithm。

你有没有尝试更新你的FileZilla客户端? 你有没有尝试另一个SFTP客户端?

另外, /usr/libexec/openssh/sftp-server存在并且具有+ x权限?

最后,你可以尝试在非守护进程模式下运行sshd和debugging选项(停止sshd服务,然后运行/usr/sbin/sshd -Dd ,然后再次用你的sftp客户端)。

看起来你试图从一个不允许的IP地址连接到你的sftp服务器。 您只允许在networking116.2.22.0/24

ACCEPT tcp – 116.2.22.0/24 tcp dpt:b2-license

你真的尝试连接到端口2204的SSH?

 ssh -p 2204 [email protected] 

我怀疑你会得到同样的超时。

当你使用sftp时,sshd服务器进程启动一个helper应用程序(你应该在sshd_config中看到对此的引用)。 我想知道是否有一些高级的安全组件,比如SELinux,它不允许它在这个端口上工作。

你使用什么操作系统发行版本?

如果使用基于RHEL的分发, sestatus报告什么内容?

这可能与协议版本控制有关。

你是否是最新版本的FileZilla?

这篇文章build议更新可能有用: https : //support.mayfirst.org/ticket/11270

你也可以尝试WinSCP,我知道这很好用(当然假设你使用的是Windows)