hi<br>i have this code from the demo. I wanted to connect using only public key authentication<br>try:<br> k = paramiko.RSAKey(filename='test_rsa') #test_rsa is priv key<br> t = paramiko.Transport(("host", port))
<br> t.connect(username="user",pkey=k) #using only public key authentication<br> sftp = paramiko.SFTPClient.from_transport(t)<br><br> # dirlist on remote host<br> dirlist = sftp.listdir('.')<br> print "Dirlist:", dirlist
<br> t.close()<br><br>except Exception, e:<br> print '*** Caught exception: %s: %s' % (e.__class__, e)<br> traceback.print_exc()<br> try:<br> t.close()<br> except:<br> pass<br> sys.exit(1)<br>
<br><br>when i ran it, it give me this error:<br><br>*** Caught exception: paramiko.AuthenticationException: Authentication failed.<br>Traceback (most recent call last):<br> File "./test.py", line 24, in ?<br>
t.connect(username="user",pkey=k)<br> File "/usr/python/lib/python2.4/site-packages/paramiko/transport.py", line 854, in connect<br> self.auth_publickey(username, pkey)<br> File "/usr/python/lib/python2.4/site-packages/paramiko/transport.py", line 1081, in auth_publickey
<br> return self.auth_handler.wait_for_response(my_event)<br> File "/usr/python/lib/python2.4/site-packages/paramiko/auth_handler.py", line 174, in wait_for_response<br> raise e<br>AuthenticationException: Authentication failed.
<br><br><br>the error log shows:<br><br> remote aes128-cbc; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none<br>DEB [20061213-23:39:31.225] thr=1 paramiko.transport: Switch to new keys ...<br>
DEB [20061213-23:39:31.230] thr=2 paramiko.transport: Attempting public-key auth...<br>DEB [20061213-23:39:31.318] thr=1 paramiko.transport: userauth is OK<br>INF [20061213-23:39:31.699] thr=1 paramiko.transport: Authentication (publickey) failed.
<br>DEB [20061213-23:39:31.810] thr=1 paramiko.transport: EOF in transport thread<br><br>What am i doing wrong? <br>thanks<br>