从一个错误再谈FTP模式
情况概述:
Linux上建好了ftp服务器
客户端为linux时没问题
客户端为windows XP SP2,用软件的ftp客户端(IE,CuteFTP)都可以正常访问,但是在cmd命令行下出错
C:\Documents and Settings\Administrator>ftp [url]www.abc.com.cn[/url]
Connected to [url]www.abc.com.cn.[/url]
220 ProFTPD 1.3.0rc2 Server (ProFTPD Default Installation)
User ([url]www.abc.com.cn:[/url](none)): yahoon
331 Password required for yahoon.
Password:
230 User yahoon logged in. //登陆成功
ftp> dir //执行dir命令
500 Illegal PORT command
425 Unable to build data connection: Connection refused
ftp>
经查这是由于
Windows系统下的FTP命令行模式不支持“被动访问模式(PASV)”. 虽然你可以使用QUOTE PASV这个命令强制使用PASV模式,但是当你用dir命令列出服务器目录列表,你会发现它还是使用PORT方式来连接服务器的。
关于FTP的两种访问方式
主动方式 PORT
客户端连到服务器的21发控制指令.服务器的20连到客户端传数据
被动方式 PASV
客户端连到服务器的21发控制指令.服务器提供一个端口(>1024),让客户端连上来.
附:
IE是默认采用的PASV方式连接服务器,具体设置和查看方法如下
Internet Explorer: To make this change in Internet Explorer go to the "Tools" menu and click . "Internet Options". In the "Internet Options" window, click . the "Advanced" tab. Scroll down to find an option labeled "Use Passive FTP", and check or uncheck the box.
本文转自yahoon 51CTO博客,原文链接:http://blog.51cto.com/yahoon/90279,如需转载请自行联系原作者