import subprocess
import sys
COMMAND="ls"
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
result = ssh.stdout.readlines()
if result == []:
error = ssh.stderr.readlines()
print >>sys.stderr, "ERROR: %s" % error
else:
print result
When I try to
execute this
script, I get prompt for
password. Is there any way I could
avoid it, for example, can I enter password in script somehow? Also, password should be encrypted somehow so that
people who have
access to the script cannot see it.
Can you answer this question?
Write Answer1 Answers