[BangPypers] Help On Paramiko

vijay vnbang2003 at yahoo.com
Tue Jun 19 16:45:56 CEST 2012

Can you try to add this step(after missing_host_key_policy())  for public private key between two machine you want to run.
paramiko.RSAKey.from_private_key_file() this is what helped me solved  issue what i had with communication between machines.

Hope this helps you 

With Thanks

 From: "Nikunj.Badjatya at emc.com" <Nikunj.Badjatya at emc.com>
To: python-list at python.org; bangpypers at python.org 
Sent: Tuesday, 19 June 2012 11:58 AM
Subject: [BangPypers] Help On Paramiko
Howdy All,

I am trying to use paramiko to automate logging in to remote unix machines and executing some commands there.
When I normally do ssh from my linux machine (with Python 2.6) to this machine a different '>' prompt comes. It's a device specific custom prompt.
After I run 'enable' command here, a new prompt opens up. '#' which is also custom prompt.
Then I need to run 'configure terminal' there. And then some more device specific commands.

Linux # Ssh admin at xx.xx.xx.xx<mailto:admin at xx.xx.xx.xx>

Ø  Enable
#     configure terminal
#     <more commands>

Can this be done using paramiko?
I tried with:

import paramiko

client = paramiko.SSHClient()
client.connect('xx.xx.xx.xx', username='admin', password='')
stdin, stdout, stderr = client.exec_command('enable')
#stdin.write('configure t')

(There is no passwd for username admin.)

['UNIX shell commands cannot be executed using this account.\n']

Any suggestions?

BangPypers mailing list
BangPypers at python.org

More information about the BangPypers mailing list