Re: lftp issued “CWD /” results in e rror message but the transfer does not fail

Alexander Lukyanov <[email protected]> Mon, 26 Aug 2019 23:32:54 +0300
Newsgroups gmane.network.lftp.user
Message-ID <CANnoEwo9up7FQ=KL1_DShsfoZzVmz-_5DOmgsKEb+bbZc_aRrw@mail.gmail.com>
--===============1958884188917770097==
Content-Type: multipart/alternative; boundary="00000000000031b3e705910b1028"

--00000000000031b3e705910b1028
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

That's correct, omitting the path altogether will do the same.

However, there is a bug in lftp - it does not follow RFC 1738 for ftps URL
scheme. It will be fixed in the next version.

=D0=BF=D0=BD, 26 =D0=B0=D0=B2=D0=B3. 2019 =D0=B3. =D0=B2 18:26, Kevin R. Bu=
lgrien <[email protected]
>:

> Thanks,  yes, a tilde following works as desired, however, I feel somewha=
t
> disappointed that I didn't previously think about simply dropping the
> trailing slash from the URL.  For example:
>
> ftps://server.example.net vs. ftps://server.example.net/
>
> --
>
> Kevin R. Bulgrien
>
> ------------------------------
>
> *From: *"Alexander Lukyanov" <[email protected]>
> *To: *"Kevin R. Bulgrien" <[email protected]>
> *Cc: *"LFTP Mailing List" <[email protected]>
> *Sent: *Saturday, August 24, 2019 4:39:21 AM
> *Subject: *Re: [lftp] lftp issued =E2=80=9CCWD /=E2=80=9D results in erro=
r message but
> the transfer does not fail
>
> Try adding a tilde at the end of url.
>
> =D0=BF=D1=82, 23 =D0=B0=D0=B2=D0=B3. 2019, 18:30 Kevin R. Bulgrien <kevin=
[email protected]>:
>
>> 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=3Dno"; 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=3D0
>>   ---> 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 fixe=
d
>>   ---- 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 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
>> [email protected]
>> http://univ.uniyar.ac.ru/mailman/listinfo/lftp
>>
>
> _______________________________________________
> lftp mailing list
> [email protected]
> http://univ.uniyar.ac.ru/mailman/listinfo/lftp
>


--=20
   Alexander.

--00000000000031b3e705910b1028
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">That&#39;s correct, omitting the path altogether will do t=
he same.<div><br></div><div>However, there is a bug in lftp - it does not f=
ollow RFC 1738 for ftps URL scheme. It will be fixed in the next version.</=
div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_at=
tr">=D0=BF=D0=BD, 26 =D0=B0=D0=B2=D0=B3. 2019 =D0=B3. =D0=B2 18:26, Kevin R=
. Bulgrien &lt;<a href=3D"mailto:[email protected]">kevinb@system=
sdesignusa.com</a>&gt;:<br></div><blockquote class=3D"gmail_quote" style=3D=
"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-le=
ft:1ex"><div><div style=3D"font-family:arial,helvetica,sans-serif;font-size=
:10pt;color:rgb(0,0,0)">Thanks, =C2=A0yes, a tilde following works as desir=
ed, however, I feel somewhat<div>disappointed=C2=A0<span style=3D"font-size=
:10pt">that I didn&#39;t previously think about</span><span style=3D"font-s=
ize:10pt">=C2=A0simply dropping the</span></div><div><span style=3D"font-si=
ze:10pt">trailing slash=C2=A0</span><span style=3D"font-size:10pt">from the=
=C2=A0</span><span style=3D"font-size:10pt">URL.</span><span style=3D"font-=
size:10pt">=C2=A0 For example:</span></div><div><div><div><div><br></div><d=
iv><span style=3D"font-family:Helvetica,Arial,sans-serif;font-size:16px">ft=
ps://</span><a href=3D"http://server.example.net/" rel=3D"noreferrer norefe=
rrer" style=3D"font-family:Helvetica,Arial,sans-serif;font-size:16px" targe=
t=3D"_blank">server.example.net</a>=C2=A0vs.=C2=A0<span style=3D"font-famil=
y:Helvetica,Arial,sans-serif;font-size:16px">ftps://</span><a href=3D"http:=
//server.example.net/" rel=3D"noreferrer noreferrer" style=3D"font-family:H=
elvetica,Arial,sans-serif;font-size:16px" target=3D"_blank">server.example.=
net</a>/</div><div></div><div><br></div><div></div><div></div><div><div><sp=
an name=3D"x"></span>--<br><br>Kevin R. Bulgrien</div><div id=3D"gmail-m_-3=
401096972402133542ea9888ce-e6e7-4221-81cf-04ae291aac60"><br></div><hr id=3D=
"gmail-m_-3401096972402133542zwchr"><blockquote style=3D"border-left:2px so=
lid rgb(16,16,255);margin-left:5px;padding-left:5px;color:rgb(0,0,0);font-w=
eight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,A=
rial,sans-serif;font-size:12pt"><b>From: </b>&quot;Alexander Lukyanov&quot;=
 &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
om</a>&gt;<br><b>To: </b>&quot;Kevin R. Bulgrien&quot; &lt;<a href=3D"mailt=
o:[email protected]" target=3D"_blank">[email protected]=
m</a>&gt;<br><b>Cc: </b>&quot;LFTP Mailing List&quot; &lt;<a href=3D"mailto=
:[email protected]" target=3D"_blank">[email protected]</a>&gt;<br><b>Sent:=
 </b>Saturday, August 24, 2019 4:39:21 AM<br><b>Subject: </b>Re: [lftp] lft=
p issued =E2=80=9CCWD /=E2=80=9D results in error message but the transfer =
does not fail<br><br><div dir=3D"auto"><div>Try adding a tilde at the end o=
f url.<br><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_at=
tr">=D0=BF=D1=82, 23 =D0=B0=D0=B2=D0=B3. 2019, 18:30 Kevin R. Bulgrien &lt;=
<a href=3D"mailto:[email protected]" target=3D"_blank">kevinb@sys=
temsdesignusa.com</a>&gt;:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">In a scripted and automated process, it seems beneficial to avoi=
d<br>
generating unwanted error messages that do not indicate an actual<br>
fault, if only to avoid confusion when someone looks at the logs.<br>
<br>
Given an lftp command similar to the following:<br>
<br>
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 =
&quot;ssh -a -x -o PubkeyAuthentication=3Dno&quot;; set net:max-retries 2; =
open -e &#39;put /path/to/data/upload.txt;&#39; -u username:password ftps:/=
/<a href=3D"http://server.example.net/" rel=3D"noreferrer noreferrer" targe=
t=3D"_blank">server.example.net/</a><br>
<br>
The command template works on various servers, but, on one server,<br>
even though the upload is successful, an error message is shown:<br>
<br>
=C2=A0 ---- CWD path to be sent is `/&#39;<br>
=C2=A0 &lt;--- 200 Command OPTS succeed<br>
=C2=A0 ---&gt; CWD /<br>
=C2=A0 &lt;--- 550 Permission denied<br>
=C2=A0 cd: Access failed: 550 Permission denied (/)<br>
<br>
How does one prevent lftp from sending CWD / to this server<br>
<br>
=C2=A0 &lt;--- 230 User logged in<br>
=C2=A0 ---&gt; FEAT<br>
=C2=A0 &lt;--- 211-Extensions supported<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0SIZE<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0XMD5<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0XSHA1<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0XSHA256<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0XSHA512<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0XQUOTA<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0LANG EN, ES, FR, GE<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0MDTM<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0MLST size*;type*;perm*;create*;modify*;<b=
r>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0REST STREAM<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0TVFS<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0UTF8<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0AUTH SSL;TLS-P;<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0PBSZ<br>
=C2=A0 &lt;---=C2=A0 =C2=A0 =C2=A0PROT C;P;<br>
=C2=A0 &lt;--- 211 end<br>
=C2=A0 ---&gt; PWD<br>
=C2=A0 &lt;--- 257 &quot;/username/folder&quot; is current directory<br>
=C2=A0 ---&gt; PBSZ 0<br>
=C2=A0 &lt;--- 200 PBSZ=3D0<br>
=C2=A0 ---&gt; PROT P<br>
=C2=A0 &lt;--- 200 PRIVATE data channel protection level set<br>
=C2=A0 ---&gt; LANG<br>
=C2=A0 &lt;--- 200 Default languages set to EN<br>
=C2=A0 ---&gt; OPTS UTF8 ON<br>
=C2=A0 &lt;--- 200 Command OPTS succeed<br>
=C2=A0 ---&gt; OPTS MLST size;type;perm;modify;<br>
=C2=A0 ---- CWD path to be sent is `/&#39;<br>
<br>
Note that the server automatically sets its default upload<br>
directory based on the username... i.e. /username/folder<br>
<br>
The upload should go to this default upload directory without<br>
generating an error message. It does get uploaded, but the<br>
log shows the error message:<br>
<br>
=C2=A0 cd: Access failed: 550 Permission denied (/)<br>
=C2=A0 ---&gt; TYPE I<br>
=C2=A0 &lt;--- 200 Transfer mode set to BINARY<br>
=C2=A0 ---&gt; PASV<br>
=C2=A0 &lt;--- 227 Entering Passive Mode (10,10,35,21,195,225).<br>
=C2=A0 ---- Address returned by PASV seemed to be incorrect and has been fi=
xed<br>
=C2=A0 ---- Connecting data socket to (nnn.nnn.nnn.nnn) port 50145<br>
=C2=A0 ---- Data connection established<br>
=C2=A0 ---&gt; ALLO 148891<br>
=C2=A0 &lt;--- 200 Command ALLO succeed<br>
=C2=A0 ---&gt; STOR upload.txt<br>
=C2=A0 &lt;--- 150 Uploading in BINARY file upload.txt<br>
=C2=A0 Certificate: ...<br>
=C2=A0 Issued by: ...<br>
=C2=A0 Trusted<br>
=C2=A0 WARNING: Certificate verification: hostname checking disabled<br>
=C2=A0 ---- Closing data socket<br>
=C2=A0 &lt;--- 226 Transfer completed<br>
=C2=A0 ---&gt; SITE UTIME 20190819100016 upload.txt<br>
=C2=A0 &lt;--- 550 Command SITE failed<br>
=C2=A0 ---&gt; QUIT<br>
=C2=A0 ---- Closing control socket<br>
<br>
A number of things have been tried. For example, using various<br>
paths with the put command.<br>
<br>
* put -O . /path/to/data/upload.txt<br>
* put -O /username/folder /path/to/data/upload.txt<br>
<br>
Explicitly placing a cd /username/folder command was also attempted.<br>
<br>
Removing -vv and -d are ineffective as well.<br>
<br>
How can lftp be made to avoid automatically issuing the &quot;CWD /&quot;<b=
r>
that causes the unwanted and confusing error message that does<br>
not mean an operation intended by the user actually failed?<br>
<br>
Alternatively, as opposed to stopping the issuance of the &quot;CWD /&quot;=
,<br>
how might one at least suppress its being treated as an error<br>
without also suppressing real errors?<br>
<br>
Experienced on RHEL 7:<br>
<br>
$ lftp --version<br>
LFTP | Version 4.4.8 | Copyright (c) 1996-2013 Alexander V. Lukyanov<br>
...<br>
Libraries used: Readline 6.2<br>
<br>
--<br>
<br>
Kevin R. Bulgrien<br>
_______________________________________________<br>
lftp mailing list<br>
<a href=3D"mailto:[email protected]" rel=3D"noreferrer" target=3D"_blank">l=
[email protected]</a><br>
<a href=3D"http://univ.uniyar.ac.ru/mailman/listinfo/lftp" rel=3D"noreferre=
r noreferrer" target=3D"_blank">http://univ.uniyar.ac.ru/mailman/listinfo/l=
ftp</a><br>
</blockquote></div></div></div>
</blockquote><br></div></div></div></div></div></div>______________________=
_________________________<br>
lftp mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a=
><br>
<a href=3D"http://univ.uniyar.ac.ru/mailman/listinfo/lftp" rel=3D"noreferre=
r" target=3D"_blank">http://univ.uniyar.ac.ru/mailman/listinfo/lftp</a><br>
</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
 class=3D"gmail_signature"><div dir=3D"ltr"><div></div>=C2=A0=C2=A0 Alexand=
er.<br></div></div>

--00000000000031b3e705910b1028--

--===============1958884188917770097==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
lftp mailing list
[email protected]
http://univ.uniyar.ac.ru/mailman/listinfo/lftp

--===============1958884188917770097==--