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();
| [reply] [d/l] |
|
|
$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
| [reply] [d/l] [select] |
|
|
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
| [reply] [d/l] |
|
|
|
|
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
| [reply] [d/l] |
|
|
|
|
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.
| [reply] |
|
|
|
|
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.
| [reply] [d/l] |
|
|
A reply falls below the community's threshold of quality. You may see it by logging in.
|
|
|
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.
| [reply] |
|
|
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!!!
| [reply] [d/l] |
|
|
|
|
|
|
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
| [reply] [d/l] |
|
|
I get an error 530 invalid user/pass
| [reply] |
|
|
| [reply] |