sftp login without password

Joshua Kugler joshua at joshuakugler.com
Tue Oct 6 22:26:34 CEST 2009


David wrote:
> transport.connect(username = username, pkey = mykey)
> 
> I get a "AuthenticationException: Authentication failed." exception.
> 
> 
> My ~/.ssh/id_rsa is correct because if, at console, I type
> 
> bagside at bagvapp:~$ sftp bagside at 192.168.92.129
> Connecting to 192.168.92.129...
> sftp>
> 
> I get a successful login. How can I get an sftp login without using a
> password in python?
> I am using Ubuntu 9.04, python 2.6.2 and paramiko 1.7.5

What is the contents of 'mykey'?  Is it a file object? A string containing
the contents of ~/.ssh/id_rsa? The Paramiko docs indicate mykey should be a
subclass of PKey, probably RSAKey.

So, you'd need to do:

mykey = RSAKey.from_private_key_file('/path/to/private/key/id_rsa')
transport.connect(username = username, pkey = mykey)

Beyond that, I"m not sure.  Of course, I've never used Paramiko before.

j




More information about the Python-list mailing list