Skip to main content

Excecute remote commands on several hosts, with SSH

Project description

SSH Commander

This command line tool, allows you to execute various commands on several remote hosts, using the SSH protocol. As a result, you get a per-host generated output of each command you specified.

You simply specify a plain text file with a list of remote hosts to connect to (domain names or IP addresses), and a comma-separated list of commands to execute on those. Note that access credentials (user and password) must be the same for all the target hosts!.

Requirements

Make sure your system meets the following requirements:

Installation

The recommended method for installing this tool, is using pip:

pip install ssh-commander

Usage

When using ssh-commander, respect the following syntax:

Execute remote commands on several hosts, with SSH.
usage: ssh-commander [-h] [-p PORT] [-v] FILE USER COMMANDS

Excecute remote commands on several hosts, with SSH.

positional arguments:
  FILE                  Plain text file with list of hosts
  USER                  User to login on remote hosts
  COMMANDS              Comma separated commands to be executed on remote
                        hosts

optional arguments:
  -h, --help            show this help message and exit
  -p PORT, --port PORT  Specify SSH port to connect to hosts
  -v, --version         Show current version

First, remember to create a text file (name it whatever you like), where you list the target hosts. Its content, may look like this:

# This is a comment. It'll be ignored!.
192.168.0.10
192.168.0.11
192.168.0.12

Also, note that the password for the user provided, is gonna be asked only once. Therefore, those credentials, should be valid on all target hosts!.

Examples

Let's say you have some managed switches (or routers):

ssh-commander hosts.txt root "terminal length 0, sh port-security"

They could rather be some GNU/Linux servers, as well:

ssh-commander hosts.txt foones "hostname, whoami"

Project details


Release history Release notifications

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ssh-commander, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size ssh_commander-0.1-py3-none-any.whl (17.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size ssh-commander-0.1.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page