atinux / node-ftps

FTP, FTPS and SFTP client for node.js, mainly a lftp wrapper.
MIT License
202 stars 57 forks source link

Password that gets escaped (escape set true) fails authentication #49

Open dustinbolton opened 7 years ago

dustinbolton commented 7 years ago

I happened to have a password to one site containing the string "&". With escape enabled this resulted in a the password sent to lftp being escaped which resulted in authentication failing. I changed the password to work around this but I worry there may be other password escaping glitches with escaping enabled causing lftp to fail to authenticate.

Note that this happened when using execAsStream() if that matters.

LiamWheldon commented 7 years ago

I've had the exact same issue, it's your comment that diagnosed the issue for me. I tested with raw() ls() and put() looks like every param values must be getting escaped...

Liam

lopic34 commented 2 years ago

Same for me too: password with escaped characters make my system impossible to connect. In my case, the password have this characters : $);] (I don't know which one is the "bad one") Thank to post in this issue, and I solved it by changing the escape parameter to false:

            const ftps = new FTPS({
              host: xxxx,
              port: xxxx,
              username: xxxx,
              password: xxxx, //(contain $);]
              protocol:  xxxx,
              **escape: false,  //it was _true_ by default**
              retries: 3,
              timeout: 20,
              autoConfirm: true
})

I can see there is no update since 3 years, but if this post message can help some of you, it is great!

Except this password problem, this SFTP is well done and works very fine. A big thank to Sébastien for this great job. Bravo !

atl3tico commented 1 year ago

That's because you don't want to escape your password. Use bareCredentials option:


const ftps = new FTPS({
              host: xxxx,
              port: xxxx,
              bareCredencials: `${username}:${password}`,
              protocol:  xxxx,
              escape: true,
              retries: 3,
              timeout: 20,
              autoConfirm: true
})```