服务器修改了组网结构,同事反馈FTP命令无法使用了,现象如下:

CODIGG-SUSE # ftp user@www.codigg.com
Connected to www.codigg.com.
220 Welcome
331 Welcome ‘user’, enter password to login.
Password:
230 User userj logged in.
Remote system type is UNIX.
Using binary mode to transfer files.

ftp> ls
229 Entering Extended Passive Mode (|||2772|)
200 EPRT command successful.

既然如此,又请出法宝CURL,再次参见文章:shell命令:使用curl操作ftp(上传、下载、删除等)

使用命令 curl -s -u user:psw ftp://www.codigg.com  发现测试结果一切正常。

而且服务器配置修改中,修改了组网,但是没有动ftp服务器(在公网),于是至少肯定是client的问题,先使用命令:passive on ,再测试依然不行,由于动了F5配置,有可能是IP方面,于是:

先用epsv4 off 禁掉EPSV,再ls此时一切正常

Google了一下,看到别人的解释:

目前在suse linux上缺省的ftp client基本上都是lukemftp,默认启用了EPSV,与某些FTP服务器存在兼容性问题。

原文:

Toggle the use of the extended EPSV and EPRT commands on IPv4 connections;first try EPSV / EPRT, and then PASV / PORT. This is enabled by default.If an extended command fails then this option will be temporarily disabled for the duration of the current connection, or until epsv4 is executed again.

有些较老的ftp server对EPSV / EPRT 支持存在问题,因此需要执行epsv4关闭这两个命令,使用老命令 PASV / PORT 访问。

看来还需要好好学习一下FTP协议相关的知识~