Using Python to run SSH commands on a remote server

J

John Salerno

Generally speaking, what tools would I use to do this? Is there a built-in
module for it? I looked at the telnetlib module, but the documentation
wasn't really complete enough for me to get a good idea of it. Is Telnet and
SSH even the same thing?

Basically, I want to write a script that will automate the process of making
all .py files on my web server executable (chmod 755, or something similar).

Thanks.
 
M

Mark Wooding

John Salerno said:
Generally speaking, what tools would I use to do this? Is there a built-in
module for it?

There's paramiko (q.g.). I can't personally vouch for it, but it seems
popular... It seems to depend on a separate crypto library.
Is Telnet and SSH even the same thing?

No. They're very different.

-- [mdw]
 
J

John Salerno

Jeffrey Froman said:
Be careful, this procedure sounds potential risky, security-wise ;-)

I guess a blanket process might be a tad risky, but don't you want all CGI
files to be executable by all?
 
J

John Salerno

Jeffrey said:
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! :)
 
S

subeen

T

Taygun Kekec

Alson you can take a look at pexpect module if you want to automate
logging in and process commands , in this way you will no longer wait
for loginname and password prompt.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top