[Tutor] Can I can use subprocess module for connecting to linux from windows

Alan Gauld alan.gauld at yahoo.co.uk
Fri Feb 10 05:06:54 EST 2017


On 10/02/17 06:48, Basavaraj Lamani wrote:

> putty, I will do SSH connection to Linux machine(VM). I enter username and
> password to access Linux machine(VM) then I enter different commands to
> install application in Linux machine.
> 
> Automation: I want to automate above manual task by using python standard
> subprocess module. 

The way I'd do that is write a Linux shell script to do all the Linux
work then use Python to ftp(*) a copy of the script to the Linux box and
just use ssh to run that script.

Trying to use subprocess to drive an interactive ssh session is an
exercise in frustration which I would avoid if at all possible.
Running a single command is much easier.

(*)Of course that assume you have an ftp server running on Linux...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list