[Tutor] SSH commands in Python on Linux
alan.gauld at freenet.co.uk
Wed Aug 10 23:59:17 CEST 2005
os.system( 'ssh root at 192.168.10.204 "ls"' )
system is probably the wrong thing to use here since it doesn't
return any output only a final error code.
> 1- Is there a way to not be asked for the root password?
Yes but you need to set up user security keys and such.
The ssh man pages explain it in fairly dense detail.
> 2- If not, then is it possible to feed the SSH password
> input with my Python script?
Yes but you probably need the python version of expect module.
Not part of the standard library but available on source-forge
More information about the Tutor