pimperator has asked for the wisdom of the Perl Monks concerning the following question:
I followed the Monk's guide to FTP::Net and I still cannot get my script to connect to the server. Here's my code
#!/usr/bin/perl use strict; use warnings; use Net::FTP; my $host = "blah.blahblah.nl"; my $user = "ftpuser"; my $password = "qwerty"; my $f = Net::FTP->new($host, Port => 22, Debug=> 1) or die "Cannot ope +n $host\n"; $f->login($user,$password) or die "cannot log $user in\n"; my $dir = "/home/files/cool_beans"; $f->cwd($dir) or die "Can't cwd to $dir\n"; my @files = $f->ls; print @files, "\n";
Here's the output on the terminal
bucephalus:Desktop barney$ perl ftp_test.pl Net::FTP>>> Net::FTP(2.77) Net::FTP>>> Exporter(5.66) Net::FTP>>> Net::Cmd(2.29) Net::FTP>>> IO::Socket::INET(1.33) Net::FTP>>> IO::Socket(1.34) Net::FTP>>> IO::Handle(1.33) Net::FTP=GLOB(0x7ff09b0b55d8)<<< SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2 Cannot open blah.blahblah.nl
Am I doing something wrong? Or is it the server? I can login using FileZilla with the same credentials. I am using a Windows device and the server appears to be Unix; could this be an issue with logging in? I tried running the same script on my Mac device and on a Unix cluster and same failure.
My goal is to parse through a lot of files on the server and print the output locally on my device. Is there another way to accomplish this task?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::FTP Cannot login to server
by AppleFritter (Vicar) on Jul 26, 2014 at 20:20 UTC | |
by pimperator (Acolyte) on Jul 26, 2014 at 20:42 UTC | |
by Corion (Patriarch) on Jul 26, 2014 at 20:44 UTC | |
|
Re: Net::FTP Cannot login to server
by 1s44c (Scribe) on Jul 27, 2014 at 11:35 UTC |