Windows SSH (remote execution of commands) - Python Automation
Cameron Laird
claird at lairds.us
Mon Dec 29 09:26:36 EST 2008
In article <mailman.6325.1230551707.3487.python-list at python.org>,
Tino Wildenhain <tino at wildenhain.de> wrote:
.
.
.
>> 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.
.
.
.
Good advice, all around. I'll reinforce a few of your
points:
A. I entirely agree that Mr. Raghu would likely
do well to learn about cron(8); automation of
the sort that seems to be involved here is
generally more convenient with standard Linux
tools than from the Windows side.
B. One of the Windows command-line automaters
to which you alluded is a sibling of putty:
plink <URL:
http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html >.
It shares configuration and infrastructure
elements with putty, and might require the
least adjustment.
C. 'You think paramiko is harder? I find it a
nice solution in many situations.
More information about the Python-list
mailing list