Using Python to run SSH commands on a remote server

subeen tamim.shahriar at gmail.com
Tue Jun 24 06:27:48 CEST 2008


On Jun 24, 3:51 am, John Salerno <johnj... at gmailNOSPAM.com> wrote:
> Jeffrey Froman wrote:
> > Also note that "all .py files on my web server" is not necessarily
> > restricted to CGI scripts -- and therein lies the real gist of my
> > cautionary note.
>
> Yeah, I realized that afterwards. Good point. I was assuming all my
> executable files would be CGI, but that's not a good assumption to make! :)

You can execute ssh using os.system(). Look at
http://love-python.blogspot.com/2008/02/execute-linux-commands-in-python.html
If you want non-interactive ssh (so that your script doesn't need to
enter password), look at: http://speed-dev.blogspot.com/2008/06/non-interactive-ssh-in-linux.html

regards,
Subeen.



More information about the Python-list mailing list