I have been researching this topic and come up with some code to make
it work. It uses SSL and requires the 3rd party package Paramiko (which
requires PyCrypto). However, at this moment I have no network to test
the code on! Trying to connect to localhost (127.0.0.1) fails. Before I
buy network components, I want to be sure that this code will work.
Will someone with two networked computers try it out for me? Thanks!
Code:

def remotely_execute_command(ipaddr, port, user, passwd=None, cmd):
     import paramiko
     transport = paramiko.Transport(ipaddr + ":" + port)
     transport.connect(username=user, password=passwd)
     channel = transport.open_session()
     channel.exec_command(cmd)
     print "Command " + cmd + " executed by user " + user + " with
password " + passwd + " at " + host + ":" + port

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to