Hi I want to know how i can establish a ssh connection through python or jython and run a script file remotly on another machine. I am not sure about the platform of the machine where i want to run the script? Please provide some sample code as well. I wont mind going for some other scripting language as well.
Share
The simplest/quickest way would be to use Python’s os.system() to call the ssh command of the system:
http://docs.python.org/library/os.html?highlight=system#os.system
E.g. this works on Ubuntu
runs ‘ls -la /’ through ssh on localhost.
You will need to provide the proper command-line options to ssh, and you can set up the ssh keys to connect securely but without a password to a remote host for executing command(s):
check this out: http://www.g-loaded.eu/2005/11/10/ssh-with-keys/ or google for more info on ssh keys.