[paramiko] Problem with authentification

Robey Pointer robey at tavi.lag.net
Fri Aug 24 11:17:44 PDT 2007


On 25 Jul 2007, at 3:07, Mykle wrote:

> Hi, I'm french so I apologize for mistakes I'm about to make with  
> english...
>
> I installed Paramiko on a Debian Server for making connections with  
> an SSH Server and here's my issue:
>
> I create a transport connection with the server for getting files  
> from it. The server asks an authentification but the public key is  
> kept by the SSH Server and recognize the computer by his public key  
> username at computername, the server have a username for the public  
> key. There's no password anyway ! Until now, I use a bash script  
> which make an ssh connection with the Server (like 'ssh -x -a  
> username at sshadress'), but I want to change that for some  
> verification reasons. I mustn't have to put any key in the code...  
> What I want is to connect to the Server and that this one accept  
> this connection by only the recognization of the  
> username at computername. The documentation doesn't really help me and  
> I'm not pretty much good in Python (maybe that explains why I'm  
> writing this mail...*sic*).
>
> Here's the begining of my code:
>
> import paramiko
> TR = paramiko.Transport((sshAdress,22))
> ...
>
> ... Yeah I know, it's like there was nothing...
>
> Thank you for your help.

It seems unlikely that you can login with *just* a username, but if  
you can, the call is:

     TR.auth_none('my_username')

More likely, ssh is using your private key to authenticate.  It  
automatically looks in your ~/.ssh/ folder for a private key and if  
it finds one, it uses it.

You may want to just use SSHClient:

     client = SSHClient()
     client.load_system_host_keys()
     client.connect('hostname', username='my_username')

which will look for a private key in the same way that 'ssh' does.   
Look in the docs for SSHClient for more info.

robey




More information about the paramiko mailing list