Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Unix 2 Perl Module FTP

by talexb (Canon)
on Sep 28, 2012 at 18:38 UTC ( #996268=note: print w/replies, xml ) Need Help??

in reply to Unix 2 Perl Module FTP

Great -- now show us how you've tried to use Net::FTP to achieve the same thing, and what problems you're running into.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re^2: Unix 2 Perl Module FTP
by simbalion (Initiate) on Sep 28, 2012 at 18:43 UTC
    $ftp_site = ' 5000'; $ftp_dir = '/Directory2'; $ftp_user ='DOMAIN\/user1'; ###here is the problem line $ftp_password = "password321"; my $ftp = Net::FTP->new($ftp_site) or die "Could not connect to $ftp_site: $!"; $ftp->login($ftp_user, $ftp_password) or die "Could not login to $ftp_site with user $ftp_user: $!"; $ftp->cwd($ftp_dir) or die "Could not change remote working " . "directory to $ftp_dir on $ftp_site"; $ftp->get($ftp_get_file) or die "Could not get $ftp_get_file" . "the file is not present in $ftp_dir"; $ftp->quit();
        $ftp_user ='DOMAIN\/user1';  ###here is the problem line

      First, I'm not sure why you're escaping a forward slash. Secondly, I expect that line's not where the problem is -- I imagine the problem is lower down, where you're trying to log in to the ftp site.

      What error do you see when you run this script? Could not log in .. perhaps? Does the same login work when you try this interactively?

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

        If I login interactively from the CLI on host, I do the following: FTP OPEN ip port USER DOMAIN\user1 DOMAIN/user1 or user1@FQDN all work pass password321 I get in successfully
        I have simplified the module to this: #!/usr/bin/perl use Net::FTP; $ftp = Net::FTP->new(" 5000", Debug => 0) or die "Cannot connect to $@"; $ftp->login("Domain\\user1",'password321') or die "Cannot login ", $ftp->message; $ftp->quit; for the domain I have tried: Domain\user Domain\\user Domain\/user Domain/user Nothing will work guys. Error received: Cannot login Invalid userid/password
        Muskrat, the whole topic is about not being able to execute the script, I pasted the script in this post????? I have the correct user/pass I tested from unix ftp to windows fine, the same user/pass loaded into the variables will not work in the script.
        I have tried the following: $ftp_user = "DOMAIN\user" and also the following: "DOMAIN/user" "\\DOMAIN\user" 'DOMAIN\/user' 'DOMAIN/\user' all of them: I have tried declaring a variable $ftp_domain = 'DOMAIN'; and including it on the login section of the f +tp module e.g. $ftp->login($ftp_user, $ftp_password) added these as well ($ftp_domain, $ftp_user, $ftp_password) still inv +alid user/pass I have alos hard coded the parameters in the above login statement ins +tead of using variables.
        So did everyone give up on this one , where are the MONKs!
      Read (at least) the SYNOPSIS of the Net::FTP docs. Change the first $! to $@. Include $ftp->message() in all of the other diagnosic error messages.
        Sir I read the SYNOPSIS and line 6 is still where there is no clarific +ation: If you had a MS Domain controller where the logins were DOMAIN\user password how would you "hard code" that in line 6 of the SYNOPSIS example $ftp->login("anonymous",'-anonymous@') How would you format this pluggin in the correct syntax I swear I have + tried it all!!!
        When using your example of $ftp_user = 'DOMAIN\\user1'; I get the error: Could not login to 1000 with user DOMAIN\user1: at ./ +line 34. ##1000 is the port sed -n 34p showed me : $ftp->login($ftp_user, $ftp_password) #line 34
      I get an error 530 invalid user/pass

      Going form UNIX to Windows The file naming is different i.e /Domain/user/ftp in UNIX will be something like "C:\\Domain\\user\\ftp" for Windows.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996268]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2018-06-22 23:52 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.