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

Thursday, August 29, 2013

Microsoft FTP Service and set ftp:fix-pasv-address no

Strange. I just did an FTP login to an FTP server which calls itself Microsoft FTP Service in the greeting message. After getting the greeting message, I tried several times but was unable to do a simple ls command after having given lftp the URL, the username, and the password.

Next, I used set ftp:fix-pasv-address no to set an lftp variable. It started working.

The reason why I tried set ftp:fix-pasv-address no is because lftp in debug mode was reporting it had found multiple valid ports. I'm not sure, but I seem to recall that each port had a unique IP address as well.

Since I was getting multiple valid ports back for passive mode, I assumed at that point that this was a NAT (network address translation) problem.

Therefore, I tried set ftp:fix-pasv-address no under the assumption that the multiple valid ports were really lftp trying to fix NAT problems.

After deciding that I was going to have to use set ftp:fix-pasv-address no from now on, I tried lftp without set ftp:fix-pasv-address no to see if I could go back and document the problem. The problem has disappeared! I seem to be able to log into this particular FTP server without using the set ftp:fix-pasv-address no command.

So now I have no idea what is going on. Oh well.

Ed Abbott

Tuesday, August 6, 2013

The ls Command Loops Endlessly on Filezilla Server

I'm using Filezilla Server for the first time. I've been aware of the Filezilla client for years. I had no idea that there was a Filezilla server.

When I would log into Filezilla Server using lftp, it would reconnect endlessly (after waiting 30 seconds each time) whenever I typed the ls command. If you can't do a simple ls command, what can you do?

This very simple command at the lftp command line seems to have solved my problem:

set ftp:passive-mode off

I've not yet tested this command very extensively. However it does seem to get me beyond the problem of an ls command that loops endlessly. In a sense, the ls command was hanging.

I'll test turning passive mode off more extensively later to see whether or not this is a comprehensive solution

Here's a web page that describes active mode as older and stinkier:

LFTP Cheatsheet

Stinkier or not, active mode seems to do the trick in the case of Filezilla Server. I'm not sure why, though I suspect it may have something to do with firewalls.

However, the above webpage suggests that passive mode will go through the greatest array of firewalls without incident --- so maybe this is the exception to a general rule.

Perhaps, in this case, it is active mode that is penetrating the firewall. Just a guess on my part. I don't really know enough to know for sure.

Update: August 19, 2013

The following command seems to log me into Filezilla Server just fine:

lftp -u username,password yourftpserver.com -e "set ftp:passive-mode off"

So far, I've been able to use all the lftp commands after logging in with the above command line. This includes the ls command and the command I care about the most, the mirror -c command. Love the mirror command!

I assume that the problem with passive mode has something to do with firewalls, network address translation, and IP addresses. However, all my attempts to resolve this issue while leaving passive mode in the "on" position have failed.

So, I've given up and am accessing Filezilla Server in active mode instead. If anyone has a better idea, please post below.

I've tried using the set -d | more command to discover possible switches I can flip that will make passive mode work. So far, no switch that I've flipped from its default position has worked.

By the way. set -d | more is a great discovery tool for discovering switches to flip. Once you've flipped a switch from its default position, you can always re-establish the default by flipping the switch with no argument. No argument to any one of the switches re-establishes the default.

For example:

set ftp:passive-mode off

will turn passive mode off.

set ftp:passive-mode

re-establishes the default.

set -d | grep passive

displays the default setting for passive mode on your screen and

set -a | grep passive

displays the current setting for passive mode on your screen.

Ed Abbott

Tuesday, September 14, 2010

Pure-FTP Hangs on Login

 
Pure-FTP just now was hanging for me upon
login. I found the following web page:

lftp and pureftp stops
at making data connection


The following suggestion is the one that
did the trick for me:

set ftp:ssl-allow off

I added this to the rightmost part
of the command line:

-e "set ftp:ssl-allow off"

It worked.

Update: March 15, 2014

For whatever reason, I'm having the exact same problem—Pure-FTPd hangs on login. However, this time turning off SSL is not working.

Here's what is working:

-e "set ftp:passive-mode off"

See comment below from Francesco for an alternative way to do the same thing.

Also note that the above link suggests the opposite. The above link suggests that you turn passive mode on rather than off.

This would seem to suggest at least 3 possible reasons why lftp might hang on login with Pure-FTPd:

  1. SSL is on and needs to be turned off
  2. Passive mode is on and needs to be turned off
  3. Passive mode is off and needs to be turned on

Note that all 3 scenarios above are probably distinct FTP servers, each at a different hosting company.

I'm sure someone has a better explanation than I do as to why this is so. For now, I'm just going to assume that each case above is an FTP server that is cnfigured a little bit differently.

Ed Abbott