[paramiko] (no subject)

Robey Pointer robey at lag.net
Mon Mar 12 11:13:54 PDT 2007


On 8 Mar 2007, at 23:45, Dony Pierre wrote:

> Hi all,
>
> I use SSHClient to execute a command on a SAN switch :
>
>
> client = SSHClient()
> client.load_system_host_keys()
> client.connect(hostname,username=username,password=password)
> stdin, stdout, stderr = client.exec_command(cmd)
>
> The switch doesn't accept an authentication by key so it closes the
> connection directly in case of a try with authentication by key. I  
> have
> to use directly an authentication by password. In the Linux ssh  
> command,
> the option -o PrefferedAuthentications=password let you change the
> default option for authentications and force the first try to  
> password.
>
> How can I do the same with SSHClient. In the doc, I see for  
> SSHClient :
>
> 	Authentication is attempted in the following order of priority:
>
> 	The pkey or key_filename passed in (if any)
> 	Any key we can find through an SSH agent
> 	Any "id_rsa" or "id_dsa" key discoverable in ~/.ssh/
> 	Plain username/password auth, if a password was given
>
>
> How can I put "Plain username/password auth, if a password was  
> given" to
> the first try ?

SSHClient doesn't have a way to do that right now.  Since a lot of  
the code in SSHClient is devoted to doing those authentication steps,  
you'd probably do just as well using Transport directly.

Having flags to turn off the private key & agent discovery would be a  
worthwhile patch.

robey




More information about the paramiko mailing list