Code Monkey home page Code Monkey logo

ssh_commander's Introduction

SSH_commander

A simple script to execute system commands through SSH on multiple hosts

Dependencies and python version

SSH Commander depends on the paramiko library. No more. It runs under Python 2.7. I live in the past.

Usage

python ssh_commander.py -h

== SSH commander script ==
usage: ssh_deploy.py [-h] [-c COMMAND [COMMAND ...]] [-u] [-U]
                     [-f HOST_LIST_FILE] [--hosts ETC_HOSTS_LIST]

Command execution on multiple hosts

optional arguments:
  -h, --help            show this help message and exit
  -c COMMAND [COMMAND ...], --command COMMAND [COMMAND ...]
                        run a command
  -u, --update          update systems
  -U, --upgrade         update && upgrade systems
  -f HOST_LIST_FILE, --file HOST_LIST_FILE
                        host list file
  --hosts ETC_HOSTS_LIST
                        use /etc/hosts
  • Specify the command using -c
  • Use a host file list using -f
  • Or your /etc/hosts file using --hosts
  • You can also update or upgrade the systems using -u or -U

Host file list

The host file list has the following structure:

user@IP:port password=pass id_rsa=path/to/priv_key

Only the IP is mandatory, default values for other fileds are:

  • user: root
  • port: 22
  • pass: blank
  • id_rsa: ~/.ssh/id_rsa

If no password is specified, the private key is used. An example file is included as hostlist_example.txt.

Troubles and ameliorations

You are free to contribute to this project by reporting troubles and suggestions. Every code amelioration is welcome. Moreover, you are free to fork the code and go on your way !

ssh_commander's People

Contributors

siloufr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.