Windows SSH (remote execution of commands) - Python Automation

Tino Wildenhain tino at wildenhain.de
Mon Dec 29 12:54:57 CET 2008


Hi,

Narasimhan Raghu-RBQG84 wrote:
> Hi experts,
>  
> I am looking for some information on how to automate remote login to a 
> UNIX machine using ssh from a windows XP box.
>  
> Possible way:
>  
> 1. Use putty (or any other ssh client from windows XP). -- Can be 
> automated with command line parameters. The problem is that I am able to 
> login - Putty window opens up as well. But obviously I am unable to run 
> any commands in that. I need to find something like a handle to that 
> Putty window so that I can execute commands there.

Obviously putty is one (of several) terminal emulators (or in short gui 
clients) for ssh protocol. This means they are made for interactive work
with mouse and keyboard rather then for command automation.

Its easy if you just use one of the many command line ssh clients. You
can use os.popen() and friends or the command module to work with them.

There is also another solution:

http://www.lag.net/paramiko/

which implements the ssh protocol in python so you can do more and
have finer control over the processes and channels (for example
file transfer and command control w/o resort to multiple connections)

This is a little bit harder of course.

Also, sometimes its more easy and relieable to just use cron on unix 
side. This works much much better then Task scheduler on windows btw.

Regards
Tino


> Can anyone provide me some help in achieving this ?
>  
>  
> Thanks,
>  
> --
> *Raghu*
> 
> 
> ------------------------------------------------------------------------
> 
> --
> http://mail.python.org/mailman/listinfo/python-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20081229/787442c8/attachment.bin>


More information about the Python-list mailing list