Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

200 PORT command successful. Consider using PASV. 425 Failed to establish connection

Tags:

windows

ftp

I have setup FTP server in Ubuntu 12.04 LTS.

Now when when I try to connect to FTP server from Windows 7 through command-line ftp.exe, I get successfully connected but I cannot get the list of directory. I get error

200 PORT command successful. Consider using PASV. 425 Failed to establish connection.  
like image 750
CY5 Avatar asked Oct 22 '13 11:10

CY5


People also ask

Could not put file 425 failed to establish connection?

Answer/Solution: The 425 error means that the data channel is blocked or closed between you and the server you are trying to connect to. For Active (PORT) connections open port 21.

What is Pasv in FTP?

The PASV command tells the server to enter a passive FTP session rather than Active. This allows users behind routers/firewalls to connect over FTP when they might not be able to connect over an Active (PORT) FTP session. PASV mode has the server tell the client where to connect the data port on the server.


2 Answers

Try using the passive command before using ls.

From FTP client, to check if the FTP server supports passive mode, after login, type quote PASV.

Following are connection examples to a vsftpd server with passive mode on and off

vsftpd with pasv_enable=NO:

# ftp localhost Connected to localhost.localdomain. 220 (vsFTPd 2.3.5) Name (localhost:john): anonymous 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> quote PASV 550 Permission denied. ftp>  

vsftpd with pasv_enable=YES:

# ftp localhost Connected to localhost.localdomain. 220 (vsFTPd 2.3.5) Name (localhost:john): anonymous 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> quote PASV 227 Entering Passive Mode (127,0,0,1,173,104). ftp>  
like image 195
Shannon Avatar answered Sep 26 '22 09:09

Shannon


You are using the FTP in an active mode.

Setting up the FTP in the active mode can be cumbersome nowadays due to firewalls and NATs.

It's likely because of your local firewall or NAT that the server was not able to connect back to your client to establish data transfer connection.

Or your client is not aware of its external IP address and provides an internal address instead to the server (in PORT command), which the server is obviously not able to use. But it should not be the case, as vsftpd by default rejects data transfer address not identical to source address of FTP control connection (the port_promiscuous directive).

See my article Network Configuration for Active Mode.


If possible, you should use a passive mode as it typically requires no additional setup on a client-side. That's also what the server suggested you by "Consider using PASV". The PASV is an FTP command used to enter the passive mode.

Unfortunately Windows FTP command-line client (the ftp.exe) does not support passive mode at all. It makes it pretty useless nowadays.

Use any other 3rd party Windows FTP command-line client instead. Most other support the passive mode.

For example WinSCP FTP client defaults to the passive mode and there's a guide available for converting Windows FTP script to WinSCP script.

(I'm the author of WinSCP)

like image 45
Martin Prikryl Avatar answered Sep 23 '22 09:09

Martin Prikryl