The following code hangs then fails with 'Can't open data connection' when trying to print a simple ls command. I installed FileZilla Server with all defaults settings.
When I ftp via linux, konsole it works fine. Via konsole if I tun passive off I reproduce the what appears to be the same failure, So Iremoved $ftp->passv; cmd and it still failes on executing the ls cmd... what gives ? I've done numerous searchs and cant find a fix.
Any suggestions ?
When I ftp via linux, konsole it works fine. Via konsole if I tun passive off I reproduce the what appears to be the same failure, So Iremoved $ftp->passv; cmd and it still failes on executing the ls cmd... what gives ? I've done numerous searchs and cant find a fix.
Any suggestions ?
Code:
use Net::FTP;
use Net::Cmd;
$hostname = '192.168.1.100';
$username = 'ftp1';
$password = 'ftp1';
$home = '/';
#$remotefile = "test.txt";
#Connect Host
$ftp = Net::FTP->new($hostname) || die("Failed to create object.\n");
$ftp->login($username, $password) || die("Failed to login\n");
$ftp->pasv || die("Failed to set passive mode.\n");
#$ftp->quot('SYST');
#$ftp->quot('FEAT');
#$ftp->quot('EPSV');
#Change directory
#$ftp->cwd($home), "\n"; #Change to remote directory
print $ftp->ls($home), "\n"; #Print remote directory, FAILS HERE.
#Disconnect from host
#$ftp->binary;
#print $ftp->quot('NLST');
#$ftp->get($remotefile); #Get remote fi
$ftp->quit;