[BangPypers] Help On Paramiko

Guru guru.eceng at gmail.com
Tue Jun 19 03:04:13 EDT 2012


Refer this site you may get some useful information
http://segfault.in/2010/03/paramiko-ssh-and-sftp-with-python/


On Tue, Jun 19, 2012 at 12:00 PM, Noufal Ibrahim <noufal at nibrahim.net.in>wrote:

>
> Fabric is a library built on paramiko that gives you abstractions so
> that you don't have to worry about things at such a fine grained
> level. Perhaps you should try using that.
>
> <Nikunj.Badjatya at emc.com> writes:
>
> > 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.
> >
> > i.e.
> > {{{
> > 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.load_system_host_keys()
> > client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
> > client.connect('xx.xx.xx.xx', username='admin', password='')
> > stdin, stdout, stderr = client.exec_command('enable')
> > #stdin.write('configure t')
> > print(stdout.readlines())
> >
> > }}}
> > (There is no passwd for username admin.)
> >
> >
> > o/p
> > ['UNIX shell commands cannot be executed using this account.\n']
> >
> > Any suggestions?
> >
> > Thanks
> > Nikunj
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
>
> --
> Cordially,
> Noufal
> http://nibrahim.net.in
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
-REGARDS

Guruprasad K S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120619/6be4221b/attachment.html>


More information about the Python-list mailing list