0

Given an lftp command similar to the following:

lftp -vv -d -c set ssl:ca-file /path/to/cert/ftps_cron-bundle.crt; set ssl:check-hostname no; set ftp:ssl-protect-data true; set sftp:connect-program "ssh -a -x -o PubkeyAuthentication=no"; set net:max-retries 2; open -e 'put /path/to/data/upload.txt;' -u username:password ftps://server.example.net/

The command template works on various servers, but, on one server, even though the upload is successful, an error message is shown:

---- CWD path to be sent is `/'
<--- 200 Command OPTS succeed
---> CWD /
<--- 550 Permission denied
cd: Access failed: 550 Permission denied (/)

How does one prevent lftp from sending CWD / to this server?

<--- 230 User logged in
---> FEAT
<--- 211-Extensions supported
<---     SIZE
<---     XMD5
<---     XSHA1
<---     XSHA256
<---     XSHA512
<---     XQUOTA
<---     LANG EN, ES, FR, GE
<---     MDTM
<---     MLST size*;type*;perm*;create*;modify*;
<---     REST STREAM
<---     TVFS
<---     UTF8
<---     AUTH SSL;TLS-P;
<---     PBSZ
<---     PROT C;P;
<--- 211 end
---> PWD
<--- 257 "/username/folder" is current directory
---> PBSZ 0
<--- 200 PBSZ=0
---> PROT P
<--- 200 PRIVATE data channel protection level set
---> LANG
<--- 200 Default languages set to EN
---> OPTS UTF8 ON
<--- 200 Command OPTS succeed
---> OPTS MLST size;type;perm;modify;
---- CWD path to be sent is `/'

Note that the server automatically sets its default upload directory based on the username... i.e. /username/folder

The upload should go to this default upload directory without generating an error message. It does get uploaded, but the log shows the error message:

cd: Access failed: 550 Permission denied (/)
---> TYPE I
<--- 200 Transfer mode set to BINARY
---> PASV
<--- 227 Entering Passive Mode (10,10,35,21,195,225).
---- Address returned by PASV seemed to be incorrect and has been fixed
---- Connecting data socket to (nnn.nnn.nnn.nnn) port 50145
---- Data connection established
---> ALLO 148891
<--- 200 Command ALLO succeed
---> STOR upload.txt
<--- 150 Uploading in BINARY file upload.txt
Certificate: ...
Issued by: ...
Trusted
WARNING: Certificate verification: hostname checking disabled
---- Closing data socket
<--- 226 Transfer completed
---> SITE UTIME 20190819100016 upload.txt
<--- 550 Command SITE failed
---> QUIT
---- Closing control socket

A number of things have been tried. For example, using various paths with the put command.

  • put -O . /path/to/data/upload.txt
  • put -O /username/folder /path/to/data/upload.txt

Explicitly placing a cd /username/folder command was also attempted.

Removing -vv and -d are ineffective as well.

How can lftp be made to avoid automatically issuing the CWD / that causes the unwanted and confusing error message that does not actually mean anything failed?

$ lftp --version
LFTP | Version 4.4.8 | Copyright (c) 1996-2013 Alexander V. Lukyanov
...
Libraries used: Readline 6.2
1

Either append a tilde (~) to the end of the URL:

ftps://server.example.net/~

or, simply drop the trailing slash:

ftps://server.example.net

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.