从 Windows 到 CentOS 的 Rync 连接问题

从 Windows 到 CentOS 的 Rync 连接问题

尝试从 Windows 7 上的 Cygwin 连接到 CentOS 上的 rsync,但出现以下错误:

$ rsync -vrtz -vvv --password-file=c:\cygwin\secret --delete /cygdrive/d/Data [email protected]::modulename

opening tcp connection to xx.xx.xx.xx port 873
rsync: failed to connect to xx.xx.xx.xx (xx.xx.xx.xx): Connection timed out (116)
[sender] _exit_cleanup(code=10, file=/home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/clientserver.c, line=122): entered
rsync error: error in socket IO (code 10) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/clientserver.c(122) [sender=3.0.9]
[sender] _exit_cleanup(code=10, file=/home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/clientserver.c, line=122): about to call exit(10)

我可以从同一台 Windows 机器上的 Putty 通过 SSH 连接到该服务器。我也可以直接 ping 该 IP 地址。

我是否需要确保特定端口已打开以供 rsync 连接?

更新

正在做

cat /etc/services | grep rsync

返回

rsync           873/tcp                         # rsync
rsync           873/udp                         # rsync

另一个更新

iptables -L

输出:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere
           tcp  --  anywhere             anywhere            tcp dpt:ftp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ftp

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere
ACCEPT     ah   --  anywhere             anywhere
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

答案1

netfilter您的 CentOS 服务器上运行着默认规则集。

如果此主机仅供内部使用(不可公开访问),您可以禁用防火墙:

service iptables stop
chkconfig iptables off

但是,最好只是允许 rsync 端口:

iptables -A INPUT -p tcp --dport 873 -j ACCEPT
service iptables save

相关内容