Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / June 2005



Tip: Looking for answers? Try searching our database.

Net::FTP on Tiger

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Iyanaga Nobumi - 03 Jun 2005 12:53 GMT
Hello,

This is the first message that I send to this mailing list.  I tried  
to find something related in the archive, but couldn't find anything.

I used to use Perl scripts to do my ftp operations.  Here is an  
example of the scripts:

#!/usr/bin/perl -w

use Net::FTP;

$domain = "ftp.netscape.com";
$account = "anonymous";
$password = "";
$path = "pub/";

$ftp = Net::FTP->new($domain, Debug => 0)
         or die "Cannot connect to $domain: $@";

$ftp->login($account, $password)
         or die "Cannot login ", $ftp->message;

my @res;
@res = $ftp->ls($path);

foreach $i (0 .. $#res) {
    print $res[$i], "\n";
}

$ftp->quit;

These scripts used to work on Panther, but since I upgraded to Tiger,  
they no longer work.  It seems that I can log in to the ftp server,  
but after that, nothing happens, and I get the time-out error.  I am  
certainly doing something wrong.

I would appreciate very much any help.
Thank you in advance.

Best regards,

Nobumi Iyanaga
Tokyo,
Japan
Morbus Iff - 03 Jun 2005 13:52 GMT
> These scripts used to work on Panther, but since I upgraded to Tiger,  
> they no longer work.  It seems that I can log in to the ftp server,  but
> after that, nothing happens, and I get the time-out error.  I am  
> certainly doing something wrong.

If you disable the firewall, I'm presuming they'll work?

I don't remember the exact variable, but I *think* that adding
PASSIVE_FTP=1 to your shell's startup should fix things up.

Signature

Morbus Iff ( you are nothing without your robot car, NOTHING! )
Culture: http://www.disobey.com/ and http://www.gamegrene.com/
O'Reilly Author, Weblog, Cook: http://www.oreillynet.com/pub/au/779
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus

Chris Devers - 03 Jun 2005 14:51 GMT
> If you disable the firewall, I'm presuming they'll work?
>
> I don't remember the exact variable, but I *think* that adding
> PASSIVE_FTP=1 to your shell's startup should fix things up.

That's the old fix, and it probably still works, but you should be able
to get the same results in the OS itself now.

Quoting from the Firewall sub-panel of the Sharing panel in System
Preferences...

   To use FTP to retrieve files while the firewall is on, enable
   passive FTP mode using the Proxies tab in Network Preferences.

If you go into the Network panel and show your main interface, then
click on the Proxies tab, there will be a prominent checkbox:

   [ ] Use Passive FTP Mode (PASV)

Checking that should be equivalent to the old $PASSIVE_FTP variable, but
should apply to all programs, graphical, command line, or self-made.

Signature

Chris Devers

Morbus Iff - 03 Jun 2005 15:05 GMT
>     [ ] Use Passive FTP Mode (PASV)
>
> Checking that should be equivalent to the old $PASSIVE_FTP variable, but
> should apply to all programs, graphical, command line, or self-made.

That's a new behavior then, right? I thought that checkbox existed under
previous versions of OS X, but affected only GUI utilities. Do you have
further documentation on how it affects command line stuff now?

Signature

Morbus Iff ( you are nothing without your robot car, NOTHING! )
Culture: http://www.disobey.com/ and http://www.gamegrene.com/
O'Reilly Author, Weblog, Cook: http://www.oreillynet.com/pub/au/779
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus

Chris Devers - 03 Jun 2005 15:17 GMT
> That's a new behavior then, right? I thought that checkbox
> existed under previous versions of OS X, but affected only
> GUI utilities. Do you have further documentation on how it
> affects command line stuff now?

Oh, well then maybe I'm wrong.

I'd never noticed that checkbox under previous versions of OSX.

This page seems to be the relevant one for 10.4 --

<http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh609.html>

-- but it doesn't really clarify things one way or the other. :-/

Signature

Chris Devers

Iyanaga Nobumi - 03 Jun 2005 16:36 GMT
Hello Morbus and Chris,

Thank you for your prompt reply.

I checked my System Preferences > Sharing > Firewall: it was "On";  
then I checked my System Preferences > Network > Built-in Ethernet >  
Proxies: Use Passive FTP Mode (PASV) was checked...  So it seems that  
checking this option is not enough to make my Perl scripts work (by  
the way, I am not sure if the Firewall was "On" on my Panther  
system...).

I tried to put System Preferences > Sharing > Firewall "Off", and run  
my Perl scripts: they seem to work without problem...

Now, I am wondering if it is really necessary to set my Firewall "On"  
on a machine such as mine: it is connected to Internet permanently by  
the optical fiber, but it runs no server at all, and I use it  
strictly for my personal work...

On the other hand, command line tools like curl or lftp work without  
problem even if the Firewall is "On".

And perhaps adding "Passive => 0" to my "Net::FTP->new" line (like  
the following line...:

$ftp = Net::FTP->new($domain, Debug => 0, Passive => 0)

) would solve the problem?  I quote the man page of Net::FTP:

> Passive - If set to a non-zero value then all data transfers will
>            be done using passive mode. This is not usually required  
> except for
>            some dumb servers, and some firewall configurations.  
> This can also
>            be set by the environment variable "FTP_PASSIVE".

Anyway, I really don't know anything about the networking issues.  
Your help is greatly appreciated.

Thank you in advance for further assitance.

Best regards,

Nobumi Iyanaga
Tokyo,
Japan
Morbus Iff - 03 Jun 2005 16:50 GMT
> Now, I am wondering if it is really necessary to set my Firewall "On"  
> on a machine such as mine: it is connected to Internet permanently by  

I'd keep the firewall on. You can never have TOO much security.

> And perhaps adding "Passive => 0" to my "Net::FTP->new" line (like  the

Yes, that should work for that particular script.

Signature

Morbus Iff ( you are nothing without your robot car, NOTHING! )
Culture: http://www.disobey.com/ and http://www.gamegrene.com/
O'Reilly Author, Weblog, Cook: http://www.oreillynet.com/pub/au/779
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus

Chris Devers - 03 Jun 2005 16:54 GMT
> Now, I am wondering if it is really necessary to set my Firewall "On"
> on a machine such as mine: it is connected to Internet permanently by
> the optical fiber, but it runs no server at all, and I use it strictly
> for my personal work...

Yes, you should, even -- maybe especially -- if you're not running any
servers.

Think of it the other way around: why allow unregulated traffic to flow
into and out of your computer? Especially considering that you have a
high speed connection to the internet, there's few good reasons to allow
strangers unfirewalled access to your computer.

If some specific application breaks down because the firewall is on, you
can "punch a hole" in the firewall by going into the Firewall tab of the
Sharing panel in System Preferences, but as a rule of thumb, it's
generally considered best to leave the firewall turned on and with as
few open ports as you can get away with.

> And perhaps adding "Passive => 0" to my "Net::FTP->new" line (like
> the following line...:
>
> $ftp = Net::FTP->new($domain, Debug => 0, Passive => 0)
>
> ) would solve the problem?

Yes, this sounds like the fix you're looking for.

Signature

Chris Devers

Ray Zimmerman - 03 Jun 2005 19:03 GMT
Shouldn't that be "Passive => 1" ... it says non-zero for passive mode?

    Ray

> And perhaps adding "Passive => 0" to my "Net::FTP->new" line (like  
> the following line...:
[quoted text clipped - 9 lines]
>> This can also
>>            be set by the environment variable "FTP_PASSIVE".
Iyanaga Nobumi - 04 Jun 2005 00:14 GMT
Hello Morbus, Chris and Ray,

Thank you very much for all your help.  Now, all my scripts seem to  
work again.  And I am surer about my Firewall setting.

Thank you again!

Best regards,

Nobumi Iyanaga
Tokyo,
Japan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.