🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.security.firewalls
Article #462

Re: PASV FTP

#462
From: Brien L. Wheeler
Date: Thu, 26 Jun 1997 00:40
111 lines
4335 bytes
Julie Wyatt wrote:
> 
> Does anyone know if there is a way to initiate a PASV FTP
> session from the typical UNIX command line?  I know that it
> can be done using clients such as Fetch and Anarchie, but I
> cannot figure out how to do it from the UNIX command line.
> I have read the FAQ for this group and was unable to find
> the answer to my question.
> 
> Also, does anyone know a good definition of PASV FTP?  I know
> a little about it, and why I have to use it, but I am not quite
> sure how/why it works.
> 
> Thank You
> 
> Julie Wyatt
> http://marian.creighton.edu/~shorty
> shorty@marian.creighton.edu

You will need to use two telnet commands to simulate passive FTP,
one for the control channel and one for the data channel.  

1. In one window, set up the control channel and issue the PASV
   command to make the server listen on a random port.

>>> telnet ftp.company.com 21
    Trying 1.2.3.4...
    Connected to ftp.company.com.
    Escape character is '^]'.
    220 ftp FTP server ready.
>>> USER anonymous
    331 Guest login ok, send your complete e-mail address as password.
>>> PASS shorty@marian.creighton.edu
    230 Guest login ok, access restrictions apply.
>>> PASV
    227 Passive mode entered (1,2,3,4,128,1)


2. In a second window, set up the data channel (the port number to use
   is encoded in the "227 Passive mode entered" response).  Take the
last
   two numbers ("128" and "1" in the above example), multiply the first
   by 256 and add the second (128 * 256 + 1 = 32768 + 1 = 32769).

>>> telnet ftp.company.com 32769
    Trying 1.2.3.4...
    Connected to ftp.company.com.
    Escape character is '^]'.


3. Go back to the first window and issue your data transfer command.

    ...
    PASS shorty@marian.creighton.edu
    230 Guest login ok, access restrictions apply.
    PASV
    227 Passive mode entered (1,2,3,4,128,1)
>>> LIST
    150 Opening ASCII mode data connection for file list.
    226 Transfer complete.

4. The second window will receive the data for the command (a list of
   files in the above example).  RETR commands work similarly, as do
   STOR commands (except that you provide instead of receive the data
   for a STOR).

    telnet ftp.company.com 32769
    Trying 1.2.3.4...
    Connected to ftp.company.com.
    Escape character is '^]'.
    dr-xr-xr-x   2 root     sys          512 Jun 25 20:30 .
    dr-xr-xr-x   2 root     sys          512 Jun 25 20:30 ..
    dr-x--x--x   2 root     sys          512 Jun 25 20:30 bin
    dr-x--x--x   2 root     sys          512 Jun 25 20:30 dev
    dr-x--x--x   2 root     sys          512 Jun 25 20:30 etc
    dr-xr-xr-x   2 root     sys          512 Jun 25 20:30 pub
    dr-x--x--x   2 root     sys          512 Jun 25 20:30 usr
    Connection closed by foreign host.
 

5.  Close the control channel.

    ...
    PASV
    227 Passive mode entered (1,2,3,4,128,1)
    LIST
    150 Opening ASCII mode data connection for file list.
    226 Transfer complete.
>>> QUIT
    221 Goodbye.
    Connection closed by foreign host.


RFC 959 (STD 9) specifies the FTP protocol, including PASV.

Hope this helps...

     Brien Wheeler
     Principal Engineer
     Raptor Systems, Inc.







================================================================================
     To unsubscribe from this mailing list, please see the instructions at
               http://www.checkpoint.com/services/mailing.html
================================================================================
Technical Details
Message-ID: <33B1BA61.3202@raptor.com>
Path: arc1-ca.pugleaf.net!bignews.mediaways.net!news-han1.dfn.de!news-koe1.dfn.de!news-fra1.dfn.de!news-was.dfn.de!news.maxwell.syr.edu!nntprelay.mathworks.com!news.mathworks.com!blanket.mitre.org!raptor.com!not-for-mail

Show Full Headers
Complete Article Headers
Article: 4064 of comp.security.firewalls
Path: arc1-ca.pugleaf.net!bignews.mediaways.net!news-han1.dfn.de!news-koe1.dfn.de!news-fra1.dfn.de!news-was.dfn.de!news.maxwell.syr.edu!nntprelay.mathworks.com!news.mathworks.com!blanket.mitre.org!raptor.com!not-for-mail
From: "Brien L. Wheeler" <bwheeler@raptor.com>
Newsgroups: comp.security.firewalls
Subject: Re: PASV FTP
Date: Wed, 25 Jun 1997 20:40:01 -0400
Organization: Raptor Systems, Inc.
Lines: 104
Message-ID: <33B1BA61.3202@raptor.com>
NNTP-Posting-Host: falcon.raptor.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01 (X11; I; SunOS 5.5 sun4m)
X-Cache: nntpcache 1.0.6.5 (see ftp://suburbia.net/pub/nntpcache)