In a scripted and automated process, it seems beneficial to avoid
generating unwanted error messages that do not indicate an actual
fault, if only to avoid confusion when someone looks at the logs.

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://

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: ...
  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 mean an operation intended by the user actually failed?

Alternatively, as opposed to stopping the issuance of the "CWD /",
how might one at least suppress its being treated as an error
without also suppressing real errors?

Experienced on RHEL 7:

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


Kevin R. Bulgrien
lftp mailing list

Reply via email to