您的位置:首页 > 编程语言 > PHP开发

从一个错误再谈FTP模式 推荐

2008-07-30 16:31 225 查看
从一个错误再谈FTP[/b]模式[/b]

情况概述:
Linux上建好了ftp服务器
客户端为linux时没问题
客户端为windows XP
SP2,用软件的ftp客户端(IE,CuteFTP)都可以正常访问,但是在cmd命令行下出错
C:\Documents and Settings\Administrator>ftp
www.abc.com.cn[/b]
Connected to www.abc.com.cn.
220 ProFTPD 1.3.0rc2
Server (ProFTPD Default Installation)
User (www.abc.com.cn:(none)): yahoon
331 Password required for yahoon.
Password:
230 User yahoon logged in. //登陆成功
ftp> dir
//执行dir命令
500 Illegal
PORT command[/b]
425 Unable to build data connection: Connection refused[/b]
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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ftp to data cmd build