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!
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!