0

Am trying to automate a SSH access to a remote server with Mobaxterm in Python. I could launch Mobaxterm and send the SSH command to it using below command

import subprocess
import time
moba_path = "C:\Program Files (x86)\Mobatek\MobaXterm\MobaXterm.exe"
output = subprocess.Popen(f'{moba_path} -newtab "ssh -t -l ubuntu server1 hostname"', shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

And I get the below expected output, with the "hostname"

enter image description here

How do I return back the response, so that I can check if the SSH access was successful or not ?

.

0 Answers0