Giving a loop ssh credentials to access a bunch of boxes on my network doesnt seem to be working. Here is an example of the code:
iplist = open(savefile, 'r')
# Ssh into hosts and grab version info
for host in iplist:
info = subprocess.Popen(['sshpass', '-f', '/home/myuser/Scripts /skeleton.txt'], stdout=subprocess.PIPE)
info2 = subprocess.Popen(['ssh', 'root@'+host, 'version.pl'], stdin=info.stdout, stdout=subprocess.PIPE)
info.stdout.close()
result = info2.communicate()[0]
print result
The ssh command works, but it asks for credentials for every box rather than using the credentials passed in through sshpass. I'm assuming it's a subprocess syntax error.