[Tutor] SSH commands in Python on Linux

Bernard Lebel 3dbernard at gmail.com
Wed Aug 10 17:11:54 CEST 2005


Hello,

I'm trying to make a script to send a SSH command from a Linux
computer to another Linux compter.

The Python syntax I'm using...


import os
os.system( 'ssh root at 192.168.10.204 "ls"' )


Now the problem is that I'm always asked for the password. So my
question is two-fold:

1- Is there a way to not be asked for the root password?
2- If not, then is it possible to feed the SSH password input with my
Python script? I have about stdin redirection, but I have to admit
that I'm a bit lost and I don't know if it applies to SSH input as
well.

Right now I'm using the ls command to list processes, however
ultimately I want to be able to kill some processes within a loop
(this is for render farm management).



Thanks
Bernard


More information about the Tutor mailing list