I need a python lib to execute ssh command. I also need the output.
I tried paramiko: It was exactly what i needed but no way to execute sudo commands there. there are some online posts for that but none seem to work.
I also tried fabric: The problem is there is no way to capture output also sometimes it shows error while setting env.
Can anybody suggest something. A example of exec some sudo cmd over ssh will be good enough.
Fabric’s operation.run captures stdout and also stderr if you pass combine_stderr to run(). See http://docs.fabfile.org/en/1.3.4/api/core/operations.html#fabric.operations.run