Estou solucionando um problema com a conexão ftp de um cliente específico para o servidor. Defina-o para o modo passivo, infelizmente, não é uma opção. Estou usando o ncftp no modo de depuração para testar a conexão.
[myself@newqa ~]$ ncftp
NcFTP 3.2.4 (Apr 07, 2010) by Mike Gleason (http://www.NcFTP.com/contact/).
ncftp> debug
ncftp> passive
> passive
passive on
ncftp> passive
> passive
passive off
ncftp> open -u ftpuser my.server.com
> open -u ftpuser my.server.com
LibNcFTP 3.2.4 (April 3, 2010) compiled for linux-x86_64-glibc2.12
Uname: Linux|my.client.com|2.6.32-279.19.1.el6.x86_64|#1 SMP Sat Nov 24 14:35:28 EST 2012|x86_64
Contents of /etc/redhat-release:
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Contents of /etc/issue:
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Kernel \r on an \m
Glibc: 2.12 (stable)
Hello, dear user!
220: Hello, dear user!
Connected to 12.34.56.78.
Cmd: USER ftpuser
Password requested by 12.34.56.78 for user "ftpuser".
Please specify the password.
Password: ***********
331: Please specify the password.
Cmd: PASS xxxxxxxx
Login successful.
230: Login successful.
Cmd: PWD
257: "/"
Logged in to 12.34.56.78 as username.
Cmd: FEAT
211: Features:
EPRT
EPSV
MDTM
PASV
REST STREAM
SIZE
TVFS
End
Cmd: HELP SITE
214: The following commands are recognized.
ABOR ACCT ALLO APPE CDUP CWD DELE EPRT EPSV FEAT HELP LIST MDTM MKD
MODE NLST NOOP OPTS PASS PASV PORT PWD QUIT REIN REST RETR RMD RNFR
RNTO SITE SIZE SMNT STAT STOR STOU STRU SYST TYPE USER XCUP XCWD XMKD
XPWD XRMD
Help OK.
Logged in to www.server.com.
Cmd: CLNT NcFTP 3.2.4 linux-x86_64-glibc2.12
500: Unknown command.
ncftp / > dir
> dir
Cmd: PORT 10,36,219,101,167,190
Could not read reply from control connection -- timed out.
Could not read reply from control connection -- timed out.
List failed.
A máquina está hospedada na amazon e o firewall está configurado para permitir todo o tráfego de entrada TCP do ip do meu servidor para o cliente.
iptables está desativado no cliente
[root@newqa ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
selinux está desativado no cliente
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
Aqui está o que acontece quando tento o mesmo de um cliente que está em uma rede diferente:
Logged in to my.server.com.
Cmd: CLNT NcFTP 3.2.5 linux-x86-glibc2.15
500: Unknown command.
ncftp / > dir
> dir
Cmd: PORT 192,168,1,36,221,20
200: PORT command successful. Consider using PASV.
Cmd: LIST
150: Here comes the directory listing.
226: Directory send OK.
Remote listing contents {
drwxr-xr-x 2 ftp ftp 4096 May 02 2013 bin
drwxr-xr-x 2 ftp ftp 4096 May 02 2013 dev
drwxr-xr-x 2 ftp ftp 4096 May 02 2013 etc
drwxr-xr-x 3 ftp ftp 4096 Mar 18 06:05 incoming
drwxr-xr-x 2 ftp ftp 4096 May 02 2013 lib
drwxr-xr-x 2 ftp ftp 4096 May 02 2013 lib64
drwxr-xr-x 5 ftp ftp 4096 May 02 2013 usr
}
drwxr-xr-x 2 ftp ftp 4096 May 2 2013 bin
drwxr-xr-x 2 ftp ftp 4096 May 2 2013 bin
drwxr-xr-x 2 ftp ftp 4096 May 2 2013 dev
drwxr-xr-x 2 ftp ftp 4096 May 2 2013 dev
drwxr-xr-x 2 ftp ftp 4096 May 2 2013 etc
drwxr-xr-x 2 ftp ftp 4096 May 2 2013 etc
drwxr-xr-x 3 ftp ftp 4096 Mar 18 06:05 incoming
drwxr-xr-x 3 ftp ftp 4096 Mar 18 06:05 incoming
drwxr-xr-x 2 ftp ftp 4096 May 2 2013 lib
drwxr-xr-x 2 ftp ftp 4096 May 2 2013 lib
drwxr-xr-x 2 ftp ftp 4096 May 2 2013 lib64
drwxr-xr-x 2 ftp ftp 4096 May 2 2013 lib64
drwxr-xr-x 5 ftp ftp 4096 May 2 2013 usr
drwxr-xr-x 5 ftp ftp 4096 May 2 2013 usr
Não sabe onde contornar problemas, alguma sugestão?
Obrigado,
Depois de investigar muita e muita frustração ... tudo se resume à configuração do Amazon EC2, que não é amigável ao administrador e não permite a transferência FTP ativa. Solução: mover a máquina para um provedor de hospedagem diferente.
fonte