Your anonymous friend is partly right: the passive ftp requirement is a firewall issue. ftp connections join two arbitrary high ports on the client to ports 21 and 20 on the server. For some weird reason, in normal ftp the second of these - the data connection - is initiated by the server, and doesn't even have to return to the same machine as the control connection. Indigestion for the firewall administrator on the client side: you have to leave 1024-65535 open and try to distinguish legitimate ftp connections from sinister exploration.

in passive ftp both connections are requested by the client in the proper way. more headache on the server, because the data connection goes to a high port there, but the range of options can usually be circumscribed. the client-side firewall is much simpler and more secure because it can open the relevant port from the inside, rather than having to remain alert to ouside requests across a broad range of ports that it would rather just block and forget about.

so i'm puzzled for two reasons: why do you only have to use passive sometimes? i'd have thought that would depend on _your_ firewall and be the same for all outward ftp connections. i've come across servers that will only do active, but never the other way round. And i _really_ can't imagine why you would sometimes be allowed to connect the wrong way.

so i can clarify, but not help one tiny bit. sorry.

ps. back on topic: i think that's the first japh on the site i was able to read. But remember, adding 'use strict;' at the top of your script will alert you to common errors and sloppiness before you get into trouble.


In reply to Re: Re: Re: OT question - FTP problem by thpfft
in thread OT question - FTP problem by cLive ;-)

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.