Discussion:
curl: (67) Authentication failure for password containing # character
Sharma, Meghnath
2010-10-12 22:04:20 UTC
Permalink
Hi,

Curl Version used: curl 7.19.6
Environment: AIX 5.3
Command: curl -v -T test.txt -u gd94:gd#61ABC sftp://ftp.abc.com/test.txt

I have written a Shell script that does the SFTP file transfer (using password) to a remote machine. When I use the CURL sftp command shown above I get 'Authentication Failure' issue. But when I run regular SFTP (no CURL) using same server/user/pwd information it works perfectly fine.
I feel that CURL has an issue with '#' in the password. I even tried to escape the # character as shown below, but I got the same exception:

curl -v -T test.txt -u gd94:gd\#61ABC sftp://ftp.abc.com/test.txt

Is there any resolution w.r.t this issue? Or, do I have to use Regular SFTP instead?
I would appreciate your help.

Thanks in advance,
Megh
Daniel Stenberg
2010-10-12 22:39:01 UTC
Permalink
Post by Sharma, Meghnath
Curl Version used: curl 7.19.6
Environment: AIX 5.3
Command: curl -v -T test.txt -u gd94:gd#61ABC sftp://ftp.abc.com/test.txt
As this is SFTP, your libssh2 version is also a very important variable to
bring to the equation.
Post by Sharma, Meghnath
I have written a Shell script that does the SFTP file transfer (using
password) to a remote machine. When I use the CURL sftp command shown above
I get 'Authentication Failure' issue. But when I run regular SFTP (no CURL)
using same server/user/pwd information it works perfectly fine.
But did you provide the password to that "regular SFTP" on the command line
too? If not, I don't see how the test is comparable.

Did you try using curl without specifying the password on the command line and
instead enter it interactively to see what happens?
Post by Sharma, Meghnath
I feel that CURL has an issue with '#' in the password.
I think not. I tried this command line just now:

$ curl -v -u moo#moo:he#llo localhost

And it shows clearly that 'moo#moo' is used as user name and in the HTTP
request we see "Authorization: Basic bW9vI21vbzpoZSNsbG8=" which when base64
decoded looks like: moo#moo:he#llo ...

So, if there truly is a problem with '#' in the password with curl, it is not
generic for all protocols.

Next step, try the user+password in the URL and do the #-letter URL-encoded,
Post by Sharma, Meghnath
Is there any resolution w.r.t this issue? Or, do I have to use Regular SFTP instead?
I'm quite sure that neither curl nor libssh2 have any code that does anything
particular with #-letters in passwords.

And I trust you got it to work fine with curl if you don't have a '#' in the
password?
--
/ daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Loading...