I am using ssh to login to a remote device. I have a python script for this. The command I run is:
./python_script.py ssh device@ip_address
I want to create a password with one of the arguments for this script. I have the following in my python script.
try:
p = subprocess.Popen(
['ssh', '-s', '-l', '<name1>', <host_name>, '-p', str(port), '<something>'],
bufsize=BUFSIZE,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=False)
except Exception, err:
print 'Failed to run ssh command! (' + str(err) + ')'
sys.exit()
I don't know if my question is clear but I would like to know how to get my ssh script to accept a password parameter. I want to access it from python script using sys.argv[]