Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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


Comment on Re: Unix 2 Perl Module FTP
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 = '9.9.9.9 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("9.9.9.9 5000", Debug => 0) or die "Cannot connect to some.host.name: $@"; $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 9.9.9.9 1000 with user DOMAIN\user1: at ./test.pl +line 34. ##1000 is the port sed -n 34p test.pl 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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996268]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2015-08-31 18:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (361 votes), past polls