[paramiko] authentication failed
Robey Pointer
robey at lag.net
Sat Dec 16 20:05:45 PST 2006
On 13 Dec 2006, at 7:41, mike wrote:
> hi
> i have this code from the demo. I wanted to connect using only
> public key authentication
> try:
> k = paramiko.RSAKey(filename='test_rsa') #test_rsa is priv key
> t = paramiko.Transport(("host", port))
> t.connect(username="user",pkey=k) #using only public key
> authentication
> sftp = paramiko.SFTPClient.from_transport(t)
>
> # dirlist on remote host
> dirlist = sftp.listdir('.')
> print "Dirlist:", dirlist
> t.close()
>
> except Exception, e:
> print '*** Caught exception: %s: %s' % (e.__class__, e)
> traceback.print_exc()
> try:
> t.close()
> except:
> pass
> sys.exit(1)
>
>
> when i ran it, it give me this error:
>
> *** Caught exception: paramiko.AuthenticationException:
> Authentication failed.
> Traceback (most recent call last):
> File "./test.py", line 24, in ?
> t.connect(username="user",pkey=k)
> File "/usr/python/lib/python2.4/site-packages/paramiko/
> transport.py", line 854, in connect
> self.auth_publickey(username, pkey)
> File "/usr/python/lib/python2.4/site-packages/paramiko/
> transport.py", line 1081, in auth_publickey
> return self.auth_handler.wait_for_response(my_event)
> File "/usr/python/lib/python2.4/site-packages/paramiko/
> auth_handler.py", line 174, in wait_for_response
> raise e
> AuthenticationException: Authentication failed.
>
>
> the error log shows:
>
> remote aes128-cbc; mac: local hmac-sha1, remote hmac-sha1;
> compression: local none, remote none
> DEB [20061213-23:39:31.225] thr=1 paramiko.transport: Switch to
> new keys ...
> DEB [20061213-23:39:31.230] thr=2 paramiko.transport: Attempting
> public-key auth...
> DEB [20061213-23:39:31.318] thr=1 paramiko.transport: userauth is OK
> INF [20061213-23:39:31.699] thr=1 paramiko.transport:
> Authentication (publickey) failed.
> DEB [20061213-23:39:31.810] thr=1 paramiko.transport: EOF in
> transport thread
>
> What am i doing wrong?
> thanks
Maybe the error message could be clearer. It means your login was
rejected by the server.
robey
More information about the paramiko
mailing list