[Tutor] ssh from Windows to a Solaris server

Alan Gauld alan.gauld at btinternet.com
Tue Feb 21 01:06:01 CET 2012


On 20/02/12 21:17, Do Nguyen (donguye) wrote:

> command1 = "plink -ssh -pw myPassword myUserName at myServerIP"
> p1 = subprocess.Popen(command1)
> p2 = subprocess.Popen('ls')
>
> I could verify that command1 was executed successfully, ie. the ssh to
> myServer worked, but command2 was treated locally in the Windows

Yes, because you created a new subprocess.Popen object.
If you want to communicate with ssh in the first subprocess you need  to 
send commands to stdin on p1. There are lots of examples how to 
read/write to stdin/out in the subprocess documentation. (I'm assuming 
that plink stays open, I've never used it so don't know)

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list