Refer this site you may get some useful information<div><a href="http://segfault.in/2010/03/paramiko-ssh-and-sftp-with-python/">http://segfault.in/2010/03/paramiko-ssh-and-sftp-with-python/</a> </div><div><br><br><div class="gmail_quote">
On Tue, Jun 19, 2012 at 12:00 PM, Noufal Ibrahim <span dir="ltr"><<a href="mailto:noufal@nibrahim.net.in" target="_blank">noufal@nibrahim.net.in</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Fabric is a library built on paramiko that gives you abstractions so<br>
that you don't have to worry about things at such a fine grained<br>
level. Perhaps you should try using that.<br>
<div class="HOEnZb"><div class="h5"><br>
<<a href="mailto:Nikunj.Badjatya@emc.com">Nikunj.Badjatya@emc.com</a>> writes:<br>
<br>
> Howdy All,<br>
><br>
> I am trying to use paramiko to automate logging in to remote unix machines and executing some commands there.<br>
> 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.<br>
> After I run 'enable' command here, a new prompt opens up. '#' which is also custom prompt.<br>
> Then I need to run 'configure terminal' there. And then some more device specific commands.<br>
><br>
> i.e.<br>
> {{{<br>
> Linux # Ssh admin@xx.xx.xx.xx<mailto:<a href="mailto:admin@xx.xx.xx.xx">admin@xx.xx.xx.xx</a>><br>
><br>
> Ř  Enable<br>
> #     configure terminal<br>
> #     <more commands><br>
> }}}<br>
><br>
> Can this be done using paramiko?<br>
> I tried with:<br>
><br>
> {{{<br>
> import paramiko<br>
><br>
> client = paramiko.SSHClient()<br>
> client.load_system_host_keys()<br>
> client.set_missing_host_key_policy(paramiko.AutoAddPolicy())<br>
> client.connect('xx.xx.xx.xx', username='admin', password='')<br>
> stdin, stdout, stderr = client.exec_command('enable')<br>
> #stdin.write('configure t')<br>
> print(stdout.readlines())<br>
><br>
> }}}<br>
> (There is no passwd for username admin.)<br>
><br>
><br>
> o/p<br>
> ['UNIX shell commands cannot be executed using this account.\n']<br>
><br>
> Any suggestions?<br>
><br>
> Thanks<br>
> Nikunj<br>
> _______________________________________________<br>
> BangPypers mailing list<br>
> <a href="mailto:BangPypers@python.org">BangPypers@python.org</a><br>
> <a href="http://mail.python.org/mailman/listinfo/bangpypers" target="_blank">http://mail.python.org/mailman/listinfo/bangpypers</a><br>
><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Cordially,<br>
Noufal<br>
<a href="http://nibrahim.net.in" target="_blank">http://nibrahim.net.in</a><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
BangPypers mailing list<br>
<a href="mailto:BangPypers@python.org">BangPypers@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/bangpypers" target="_blank">http://mail.python.org/mailman/listinfo/bangpypers</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>-REGARDS<br><br>Guruprasad K S<br>
</div>