Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote server command execute

Tags:

python

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.

like image 977
bobsr Avatar asked Jan 22 '23 19:01

bobsr


2 Answers

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.

like image 57
David Z Avatar answered Jan 24 '23 08:01

David Z


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

In that case I suggest Fabric.

like image 20
Tal Weiss Avatar answered Jan 24 '23 08:01

Tal Weiss