user3754887
user3754887

Reputation: 13

Perl Net::FTP package PASV Command not implemented

I wrote the below FTP client program in perl. Which is executing fine in one server. If I try to execute the same in different server i'm getting PASV command not implemented error. If I give Passive=>0 in the FTP constructor i'm getting ALLO Command not implemented. Could you please tell why i'm getting this error and how to resolve this error.

#!/usr/bin/perl -w
use strict;           # Don't forget !
use Net::FTP;
my $host = "X.X.X.X";
my $user = "abc";
my $password = "xxx";

my $f = Net::FTP->new($host,Debug=>1) or die "Can't open $host $@\n";
$f->login($user, $password) or die "Can't log $user in\n", $f->message;
$f->binary();
$f->put("abc.txt"); # or die "unable to send the file",$f->message;
$f->quit or die "unbale to close the conenction";

--- Below is the output:

Net::FTP>>> Net::FTP(2.79)
Net::FTP>>>   Exporter(5.58)
Net::FTP>>>   Net::Cmd(2.30)
Net::FTP>>>   IO::Socket::INET(1.29)
Net::FTP>>>     IO::Socket(1.29)
Net::FTP>>>       IO::Handle(1.25)
Net::FTP=GLOB(0x99cabe8)<<< 220 X.X.X.X FTP server ready.
Net::FTP=GLOB(0x99cabe8)>>> USER abc
Net::FTP=GLOB(0x99cabe8)<<< 331 Password required for abc.
Net::FTP=GLOB(0x99cabe8)>>> PASS ....
Net::FTP=GLOB(0x99cabe8)<<< 230 User abc logged in.
Net::FTP=GLOB(0x99cabe8)>>> TYPE I
Net::FTP=GLOB(0x99cabe8)<<< 200 Type set to I.
Net::FTP=GLOB(0x99cabe8)>>> PORT X,X,X,X,221,251
Net::FTP=GLOB(0x99cabe8)<<< 200 PORT command successful.
Net::FTP=GLOB(0x99cabe8)>>> ALLO 1442
Net::FTP=GLOB(0x99cabe8)<<< 502 ALLO command not implemented.
Net::FTP=GLOB(0x86d9be8)>>> QUIT
Net::FTP=GLOB(0x86d9be8)<<< 221 Goodbye.

Upvotes: 1

Views: 1077

Answers (2)

Steffen Ullrich
Steffen Ullrich

Reputation: 123270

i'm getting PASV command not implemented error

In this case the server does not implement PASV, so you cannot use passive mode, e.g. you must set transfer mode to active to transfer data.

i'm getting ALLO Command not implemented

Also not implemented by the server, but in this case you can safely ignore this error. ALLO is just use to reserve enough space for the file to transfer and lots of servers don't implement this. The following file transfer should still work.

Edit: with Net::FTP 2.79 the return code for ALLO will no longer being ignored, but result in failure and the transfer will not be done. This means, that servers which don't correctly implement RFC959 (FTP) will stop working, because according to this RFC a server not needing to pre-allocate storage with ALLO should make this command behave the same as NOOP, e.g. return success.

Upvotes: 1

hd1
hd1

Reputation: 34657

According to the perldoc, the pasv_xfer command will activate passive mode. From that page:

pasv_xfer ( SRC_FILE, DEST_SERVER [, DEST_FILE ] )
       This method will do a file transfer between two remote ftp servers.
       If "DEST_FILE" is omitted then the leaf name of "SRC_FILE" will be
       used.

Upvotes: 0

Related Questions