From one machine, I want to SSH into another machine and run a bash script there. How to do this using Python?
I can call a local command using subprocess:
subprocess.call(myfile.sh)
I want to call myfile.sh but from another machine.
From one machine, I want to SSH into another machine and run a bash script there. How to do this using Python?
I can call a local command using subprocess:
subprocess.call(myfile.sh)
I want to call myfile.sh but from another machine.
Having seen your comment below:
import paramiko
client = paramiko.SSHClient()
#client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host_ip, username=your_username, password=your_password)
ftp = client.open_sftp()
ftp.put(myfile.sh)
stdin, stdout, stderr = client.exec_command(sh myfile) #or sh myfile.sh I think
print stdout