curl-library
Why does libcurl need the public key for SFTP auth anyway?
Date: Sat, 19 Sep 2009 15:57:43 +0000
Now that I think about it, isn't this a bug (tweaking the script
from my last post slightly)?
On Fri, Sep 18, 2009 at 05:05:43PM +0000, Gary V. Vaughan wrote:
> Here is a test script to get the size of a file over SFTP:
>
> import cStringIO
> buf = cStringIO.StringIO()
>
> options = {
> pycurl.URL: 'sftp://example.com/~/a_26MB_binary_file',
> pycurl.USERPWD: 'gary:',
> pycurl.SSH_PRIVATE_KEYFILE: '/home/gary/dsa_nopass', > #pycurl.SSH_PUBLIC_KEYFILE: '/home/gary/dsa_nopass' + '.pub',
> pycurl.HEADER: 1,
> pycurl.NOBODY: 1,
> pycurl.WRITEFUNCTION: buf.write,
> pycurl.NOPROGRESS: 1,
> }
>
> import pycurl
> c = pycurl.Curl()
> for (k, v) in options.items():
> c.setopt(k, v)
> c.perform()
Running the above script (note that SSH_PUBLIC_KEYFILE is commented
out) does this:
* About to connect() to example.com port 22 (#0)
* Trying 123.45.67.89... * connected
* Connected to example.com (123.45.67.89) port 22 (#0)
* SSH authentication methods available: publickey,password
* Using ssh public key file /home/gary/.ssh/id_dsa.pub
* Using ssh private key file /home/gary/dsa_nopass
* SSH public key authentication failed: Unable to open public key file
* Authentication failure
* Closing connection #0
Traceback (most recent call last):
File "/home/gary/pycurl", line 19, in <module>
c.perform()
pycurl.error: (67, 'Authentication failure')
Obviously the error message is because I have no id_dsa.pub file,
but SFTP authentication doesn't need it anyway, right?
Cheers,
Gary
-- Gary V. Vaughan (gary_at_thewrittenword.com)Received on 2009-09-19