0
I am automating tasks and I am new in Python, so I would like your help because I need to run a Shell script on another machine and this command I need to give inside a Python code.
I thought I’d wear something like:
#!/usr/bin/python
# -*- coding: utf8 -*-
import subprocess
subprocess.call('ssh user@host', shell=True)
But that’s why, because I don’t know how I would implement Login and Password (as well as "yes"
of cryptography).
I think you will have to "study" a little more. If you have access to both machines the best thing to do is to work with keys
rsa
and configure the file~/.ssh/config
, so you don’t need to keep moving password, user name and not even host address, so make it easy for once your life use the Fabric and be happy.– Sidon
I forgot to mention the plumbum, in case you want to go the way seemingly easier.
– Sidon