Tuesday, April 1, 2014

Authenticating FTP on Yahoo Web Hosting

I'm getting the following error message:

---> PASS my_personal_password
<--- 530 Login authentication failed

Oddly enough, this only happens when I use a script to login in this fashion:

lftp -u ftp_user@yahoo_hosted_domain.com,my_personal_password ftp.yahoo_hosted_domain.com

It's the strangest thing. The above line of code in a shell script fails. Yet, when I do what is essentially the same thing interactively at the command line, it works!

Here's how I successfully FTP to Yahoo Web Hosting using lftp interactively:

lftp ftp.yahoo_hosted_domain.com
lftp ftp.yahoo_hosted_domain.com:~> user my_user_name@yahoo_hosted_domain.com
Password: my_personal_password 

The above represents 5 steps:

  1. I type lftp ftp.yahoo_hosted_domain.com
  2. Yahoo FTP server responds with its prompt
  3. I type user my_user_name@yahoo_hosted_domain.com at the supplied prompt
  4. Yahoo FTP server responds with a password prompt
  5. I type my password at the password prompt

The reason I'm being so painfully explicit is this is the only thing I can get to work. Only manually typing everything in the FTP login process works

The only thing I can think of is it is some kind of timing issue. Of course, it I type my username first and then I'm prompted for my password, it is a lot slower. In other words, my typing speed is no match for the speed of a shell script.

Here's how other people have solved what appears to me to be the same problem:

Connecting to Yahoo Web Hosting Under lftp and Ubuntu

Cannot Connect to Yahoo Webhosting Using lftp

I've tried the above solutions but they do not seem to solve my problem. Maybe it only appears to be the same problem.

I've explicitly added -e "set ssl:verify-certificate false; set ftp:ssl-force true" to the end of my one-line shell script, but it seems to make no difference.

Something I've not tried yet is a script that does one command at a time. In other words a lftp -f script_file type script. My script is one single lftp command-line command.

Maybe I'll try again later. For now, I'm able to FTP to Yahoo Web Hosting using an interactive approach. For now, I'll keep on logging in interactively because it is working. Later, I may try for something better and more automated.

Update: April 2, 2014

I've tried a couple of other things and neither one has worked.

First I tried using a script file of the form lftp -f script_file. In my script file I use an open command followed by a user command. No surprise this did not work. It's really the same thing as placing all the information in a one-line command line inside a script.

The next thing I tried is placing the command line in a script minus the password. Surely if I left out the password information and entered it manually instead, when prompted, the manual typing of the password would slow down the timing enough to make it work. It did not.

I'm beginning to doubt it is a timing issue. That theory now seems blown out of the water. If I automate everything inside a script except the password, it still does not work.

Right now, I'm baffled. Why does this work interactively but not automatically? Why can I do it typing everything by hand but can't do it inside a script? I don't understand.

Update: April 2, 2014, 12:04 PM

I'm so embarrassed! I spent a couple of hours violating the most fundamental of all debugging rules. The rule? Look for something simple first.

The simple thing that I missed was my FTP username was misspelled. All that effort to find a simple typo!

I could not get my login script to work because I kept stubbornly copying and pasting bad information. It's funny, actually. My FTP login failed to authenticate because it was not authentic! How could I have missed something so obvious!

The bigger lesson is a life lesson. I need to relax more when I work. It's tension that caused me to overlook the obvious.

Had I been more in a childlike state of wonder, and less tense about the whole thing, I might have gotten my answer a whole lot sooner.

Oh, well.

Ed Abbott

No comments:

Post a Comment