Industry guru Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, Google AdSense, MySpace, Sony PSP, Apple iPod, Mp3 players, management, Linux, SEO, Mac OS X, Facebook, Twitter, LinkedIn and Microsoft Windows.

Why do my FTP transfers all freeze up?

I've been trying to copy some files off an FTP archive, but every time I go to do the transfer, it says "Entering Extended Passive Mode" and never gets any further. My conclusion: this passive mode thing is a bust. How can I transfer the files without using passive mode? I'm using ftp from within a Terminal on my Mac, by the way.


Dave's Answer:

This is a somewhat common problem with FTP, actually, and while I admit that I'm not entirely sure what passive mode is either, I do know how to get around it within the ftp program. Here's an example of me grabbing a file from the O'Reilly Media server:

$ ftp ftp.oreilly.com
Connected to ftp.oreilly.com.
220 ProFTPD 1.2.10 Server (ftp.oreilly.com) [172.31.173.9]
Name (ftp.oreilly.com:taylor): ftp
331 Anonymous login ok, send your complete email address as your password.
Password:
230-Welcome to the O'Reilly & Associates, Inc. FTP Archive.
230 Anonymous access granted, restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> get /demo/demofile.zip demofile.zip
local: demofile.zip remote: /demo/demofile.zip
229 Entering Extended Passive Mode (|||64758|)

That's as far as it gets. Like you, my connection hangs. Fortunately, fixing it is as easy as typing in a single command into the ftp program: EPSV.

Now watch what happens:

^C
receive aborted. Waiting for remote to finish abort.
ftp> epsv
EPSV/EPRT on IPv4 off.
ftp> get /demo/demofile.zip demofile.zip
local: demofile.zip remote: /demo/demofile.zip
227 Entering Passive Mode (209,58,173,9,252,250).
150 Opening BINARY mode data connection for /demo/demofile.zip (4908794 bytes)
100% |***************************************************| 4793 KB 163.08 KB/s 00:29
226 Transfer complete.
4908794 bytes received in 00:29 (162.48 KB/s)
ftp>

That's all there is to it. Hope that helps you get your FTP transfers going again too!



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

That may fix it, and may not.

FTP gets ugly on today's Internet, because it was designed in the 1970's, long before firewalls were common and before Network Address Translation (NAT) existed. The near universal use of firewalls and NAT on the Internet today make FTP problematic at times.

This document explains the issues and work arounds very well.
http://www.ncftp.com/ncftpd/doc/misc/ftp_and_firewalls.html

Posted by: Chris Buechler at April 8, 2006 8:52 PM

FTP Passive mode is used by most FTP programs with the prevalence of firewalls. The FTP protocol uses 2 ports (one for transfer one for control). When a file is requested the requestor sends a message to the server on the control connection. Then the server responds to the receiver by initiating a transfer connection to the requestor... but if there is a firewall, the transfer connection can't be made since the firewall will likely block it. So passive mode adds some protocol steps where the server opens up a port for the requestor to connect to for the transfer connection, sends that information to the requestor over the control channel, and the requestor makes the transfer connection. So in passive mode, all connections to the server are initiated from the requestor so they are allowed by the firewall.

Posted by: TD at April 18, 2006 8:38 AM

On my Mac OSX 10.4.8, this failed:

ftp> EPSV
?Invalid command.

HELP!!

Also, is there a way to configure this automatically?

Posted by: Tom Schneider at December 15, 2006 1:03 PM

Oh, it accepts lower case!

ftp> epsv
EPSV/EPRT on IPv4 off.

but it still hangs in 'Entering Passive Mode'.

Eventually it said


200 PORT command successful.

421 Service not available, remote server timed out. Connection closed
ftp>

Interestingly it created an empty file on the
remote computer where I was putting the file.

Posted by: Tom Schneider at December 15, 2006 1:08 PM

I'm experiencing this problem with two FTP servers. The EPSV off fix works fine one one (dataflame.co.uk) but failed on the other (p4host.com).

I have tried turning the OSX firewall off completely but this makes no difference. I have tried the terminal, Cyberduck and Yummy FTP -- same problem with all of them.

I'm running OSX 10.4.9 on an Intel Mac.

Can anyone help?!

Posted by: Lylo at March 24, 2007 3:09 AM

The general rule is that if you have a local NAT/firewall you'll want to use passive mode, and if you have a remote firewall, you'll probably need to use active mode.

EPSV is a function of the remote server. If EPSV isn't working for your specific remote server, try PASV.

Use the PASV and EPSV command to cycle passive mode off and on. Passive mode is on by default in most FTP clients.

Posted by: James Howard at November 30, 2007 1:27 PM

Thanks Dave,
This worked perfectly on the Solaris box we were grabbing data from! Had tried quote PASV before with no success.

Posted by: Lane at December 6, 2007 8:57 AM

I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]