[Tutor] SSH commands in Python on Linux
python-tutor@toddmaynard.com
python-tutor at toddmaynard.com
Wed Aug 10 17:53:20 CEST 2005
Ignoring the python stuff for the moment....
In answer to Question 1., You want to use Public Key authentication...this
will let you log in without a password. Google for SSH Public Key
Authentication will give you several hits for the howto's
One pretty good one was
http://www.puddingonline.com/~dave/publications/SSH-with-Keys-HOWTO/document/html-one-page/SSH-with-Keys-HOWTO.html
If you have access to Linux Journal magazine, they just had a great article
about it in the Sept issue.
Good luck and have fun,
Todd
On Wednesday 10 August 2005 11:11 am, Bernard Lebel wrote:
> 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
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list