4

What would be the best way to execute shell commands on remote servers and get output without actually logging in.

Maybe with shh keys. Preferably with python.

4 Answers 4

7

You mean without logging in manually? Because a server that actually let you execute commands without logging in at all would be a humongous security risk.

It looks like in the area of Python interfaces to SSH, Paramiko is what everybody's using these days. Here's a nice introductory article I found through Google: http://jessenoller.com/2009/02/05/ssh-programming-with-paramiko-completely-different/

In order to avoid entering a password every time you log in, you would indeed want to set up an SSH key pair on your computer and send the public key to the server. The method of doing so depends on what SSH client you use and what SSH server software the server uses.

Sign up to request clarification or add additional context in comments.

1 Comment

paramiko worked well for me, although I could never get sudo to work correctly per the example.
2

I'm assuming you want to streamline your usage of SSH for application deployment or systems administration tasks.

In that case I suggest Fabric.

Comments

0

Paramico is the most convenient way to use SSH with Python that I've found so far.

Good luck!

Comments

0

Paramiko is really good and convenient for transferring files and executing commands in remote server.

But, the problem is that we won't be able to catch the output of the command. It will be difficult to understand whether the command executed properly or not.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.