in reply to ...That's how perlmonks works [Re: Re: Re: trouble while ftping through Perl Script]
in thread trouble while ftping through Perl Script

I had tried that too. I gives me an error message: Cannot login Login incorrect.
I know the userid and password are correct....I've tested them directly. Just one doubt, the password contains some back slashes and $ sign. Can that be a problem? But, I am enclosing the password in quotes, so that should not be problem....??? My code is:
use Net::FTP; my $ftp = Net::FTP->new("ftp.server.com", Debug => 0) or die "Cannot c +onnect to some.host.name: $@"; my $username = 'username'; my $password = 'pa\ss\wor$d$'; $ftp->login($username,$password) or die "Cannot login ", $ftp->message +; $ftp->cwd("/files") or die "Cannot change working directory ", $ftp->m +essage; $ftp->ls("/files") or die "get failed ", $ftp->message; $ftp->quit;
  • Comment on Re: ...That's how perlmonks works [Re: Re: Re: trouble while ftping through Perl Script]
  • Download Code

Replies are listed 'Best First'.
Re: Re: ...That's how perlmonks works [Re: Re: Re: trouble while ftping through Perl Script]
by Plankton (Vicar) on Apr 30, 2004 at 05:23 UTC
    Why not just apply some simple trouble shooting. Eliminate the password issue (if possible):
  • change the password for that user to something that doesn't have \'s or $'s in it long enough to test your script.
  • or try another user that does not have special charaters in the password.

    Plankton: 1% Evil, 99% Hot Gas.
      :-( The problem is - I cannot change the password...and there is only one userid that I can use to connect to this server.
      There is one thing I noticed....
      From the command prompt, if I try to login through Method1, it allows me to login whereas if I try to login through Method2, it gives me the same error message - Login incorrect.
      Any idea why this happens?
      Method 1 (WORKING)
      ftp -n open ftp.servername.com user username P\$a\$ss\$ >> 230 User username logged in. Access restrictions apply.
      Method 2 (NOT WORKING)
      ftp -n open ftp.servername.com user username >> 331 Password required for username I enter the same password i.e. P\$a\$ss\$ I get the error message >> 530 Login incorrect. Login failed.
        Hmmm ... it is probably just a typo in your post but I noticed that in your Perl script you used ...
        my $password = 'pa\ss\wor$d$';
        ... and in your last post you use the password ...
        user username P\$a\$ss\$
        Are you very sure you are using the correct password? Maybe you should look into using sftp with PKI so you won't have to use passwords.

        Plankton: 1% Evil, 99% Hot Gas.