[Tutor] Can I can use subprocess module for connecting to linux from windows
Basavaraj Lamani
basuraj.2006 at gmail.com
Fri Feb 10 01:48:18 EST 2017
Hi,
down votefavorite
<http://stackoverflow.com/questions/42110127/how-i-can-use-subprocess-module-for-connecting-to-linux-from-windows#>
Manual testing: I have installed putty in windows10 machine and by using
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. I don't want to use third party libraries like paramiko,
pexpect etc. I am running script from windows machine. Please help me.
Below is the code( First I am trying to connect linux machine from
windows10).
import subprocess
cmd = "ssh root at 10.106.213.235"
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr =subprocess.PIPE, bufsize=1,shell=True)
output: Process finished with exit code 0
code 0 means i believe there is no error in the script. But how i can
confirm that windows machine is connected to linux machine. while running
this script, am i able to see the shell?.
I am new to programming. Please provide your inputs which is really helpful
for me.
Thanks & Regards,
Basavaraj
More information about the Tutor
mailing list