Executing remote command with paramiko

Hussein B hubaghdadi at gmail.com
Mon Aug 3 14:14:35 CEST 2009


Hey,
I'm trying to run a sudo guarded command over SSH using paramiko
+++++++++++++++++++
s = paramiko.SSHClient()
s.load_system_host_keys()
s.connect(hostname, port, username, passwd)
stdin, stdout, stderr = s.exec_command('sudo -s')
stdin.write('password\n')
stdin.flush()
print 'Flushing'
stdin, stdout, stderr = s.exec_command('harvester')
print stdout.read()
s.close()
+++++++++++++++++++
It seems to me that the sudo -s isn't getting executed at all.
I commented the sudo -s code lines and no error is shown.
Thanks for help and time.



More information about the Python-list mailing list