0

I'm new to using ftp and recently i came across this really wired situation.

I was trying to upload a file to someone else's ftp site, and i tried to use this command

lftp -e "set ftp:passive-mode true; put /dir/to/myfile -o dest_folder/`basename /dir/to/myfile`; bye" ftp://userName:passWord@ftp.site.com

but i got the error

put: Access failed: 501 Insufficient disk space : only 0 bytes available. (To dest_folder/myfile)

and when i log on to their site and check, a 0 byte file with myfile name is uploaded.

At first i thought the ftp site is out of disk space, but i then tried log on to the site using

lftp userName:passWord@ftp.site.com

and then set passive mode

set ftp:passive-mode true

and then upload the file(using another name)

put /dir/to/myfile_1 -o dest_folder/`basename /dir/to/myfile_1`

this time the file was successfully uploaded without the 501 insufficient disk space error.

Does any one know why this happens? Thanks!

user2810081
  • 589
  • 1
  • 8
  • 27
  • You might try using `lftp -d`, to enable the debug/verbose mode. Some FTP clients use the `ALLO` FTP command, to tell the FTP server to "allocate" some amount of bytes in advance; the FTP server can then accept/reject that. I suspect that `lftp` is sending `ALLO` to your FTP server, and it is the FTP server responding to that `ALLO` command with a 501 response code, causing your issue. – Castaglia Mar 18 '16 at 21:09
  • @Castaglia Thank you! I did a -d and indeed as you said, the lftp tried to ALLO and that's where it failed, after i disabled it now i can upload file successfully, but it also send a MFMT command but i don't have the permission to do that, I didn't find any information on lftp that i can disable this command. do you have any knowledge on that? Thanks! – user2810081 Mar 18 '16 at 22:36
  • You might try `set ftp:use-feat no` and/or `set ftp:trust-feat no`; most times, FTP servers announce their support for `MFMT` via the `FEAT` response, so by telling `lftp` not to ask for `FEAT` (or trust it), that _might_ work. – Castaglia Mar 18 '16 at 22:48
  • @Castaglia actually, by default, lftp set trust-feat to false, and i set use-feat to false too, now it didn't send the MFMT command, instead it send the SITE UTIME and returned a Unknown command error. Is lftp will always want to set the file modification time? seems like it is trying to find a way to do so... – user2810081 Mar 18 '16 at 23:05
  • I was looking for a way to disable that `lftp` behavior, but didn't find a way. So you might also try `set ftp:use-site-utime no` _and_ `set ftp:use-site-utime2 no`. – Castaglia Mar 18 '16 at 23:26
  • @Castaglia got it, thank you for your patience! If you have time to make it into an answer, i'll accept it. – user2810081 Mar 18 '16 at 23:55

1 Answers1

0

You might try using lftp -d, to enable the debug/verbose mode. Some FTP clients use the ALLO FTP command, to tell the FTP server to "allocate" some amount of bytes in advance; the FTP server can then accept/reject that. I suspect that lftp is sending ALLO to your FTP server, and it is the FTP server responding to that ALLO command with a 501 response code, causing your issue.

Per updates/comments, the OP confirmed that lftp's use of ALLO was indeed resulting in the initially reported behaviors. Subsequent errors happened because lftp was attempting to update the timestamp of the uploaded file; these attempts were also being rejected by the FTP server. lftp had tried using the MFMT and SITE UTIME FTP commands.

To disable those, and to get lftp to succeed for the OP, the following lftp settings were needed:

ftp:trust-feat no
ftp:use-allo no
ftp:use-feat no
ftp:use-site-utime no
ftp:use-site-utime2 no

With these settings, you should be able to have lftp upload a file without using the ALLO command beforehand, and without trying to modifying the server-side timestamp of the uploaded file using MFMT or SITE UTIME.

Hope this helps!

Castaglia
  • 2,972
  • 5
  • 28
  • 49