Coder Social home page Coder Social logo

gssh's Introduction

gssh

Run ssh command on a group of servers simultaneously. This project was inspired from mpssh and is written in Go. The reason for another mpssh fork is that it is a fun thing to do with Go.

Requirements

In order to use gssh, the ssh binary from openssh package must be installed in user's path. Also the machine running gssh should be able to connect to every server listed in the file with hosts without a password - either with a passwordless key or with ssh agent.

Build

To build gssh with official golang compiler, use the following command:

go build
./gssh -h

Another option is to use make to build with the sample makefile:

make
make install PREFIX=/usr

Usage

A list of servers is mandatory to use gssh. The list is a plain text file with one server at a line (no username):

cat << EOF > servers.txt
server1.domain.tld
server2.domain2.tld
1.2.3.4
EOF

To actually run a command on all files from the list:

./gssh -file servers.txt 'uptime'

Alternative method to run gssh is to supply list of servers to standard input:

cat << EOF | gssh 'uptime'
server1.domain.tld
server2.domain2.tld
1.2.3.4
EOF

Or to cat list files:

cat servers.txt servers2.txt | gssh 'uname -r'

A full list of currently supported arguments can be obtained with the -h option:

$ gssh -h
Usage of gssh:
  -d int
        delay between each ssh fork (default 100 msec) (default 100)
  -f string
        file with the list of hosts
  -h    show this help screen
  -n    don't use strict ssh fingerprint checking
  -p int
        number of parallel ssh processes (default: 500) (default 500)
  -s string
        name of ini section containing servers list
  -u string
        ssh login as this username (default "root")

Options:

  • d - this is the time in miliseconds to wait between spawning next process
  • f - name of a text file containing list of servers; lines starting with # and empty lines are ignored
  • p - maximum number of processes to spawn
  • n - ask not to use strict fingerprint checking; default is to use strict checking
  • u - username to use for ssh login
  • s - name of ini-like section in input file under which is the list of servers to process

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.