Re: [BangPypers] Help On Paramiko

Discussion in 'Python' started by Noufal Ibrahim, Jun 19, 2012.

  1. 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.

    <> 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 <mailto:>
    >
    > Ø 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
    >
    > http://mail.python.org/mailman/listinfo/bangpypers
    >


    --
    Cordially,
    Noufal
    http://nibrahim.net.in
     
    Noufal Ibrahim, Jun 19, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sa6113
    Replies:
    0
    Views:
    283
    sa6113
    Oct 26, 2008
  2. Frank Ruiz

    Paramiko Help

    Frank Ruiz, Jun 24, 2009, in forum: Python
    Replies:
    1
    Views:
    482
    Jon Clements
    Jun 24, 2009
  3. Frank Ruiz
    Replies:
    3
    Views:
    1,866
    Noah Dain
    Jun 25, 2009
  4. J. Clifford Dyer
    Replies:
    0
    Views:
    650
    J. Clifford Dyer
    Jun 25, 2009
  5. Michael Torrie

    Re: Help On Paramiko

    Michael Torrie, Jun 19, 2012, in forum: Python
    Replies:
    0
    Views:
    253
    Michael Torrie
    Jun 19, 2012
Loading...

Share This Page