Skip to content
golang multissh library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

This is multissh golang repo

This is useful if you work on bunch of server ( in my case like 200 ) and not able to install some manager system like ansiable. ( I have puppet, but puppet is so slow )

Usually if we need quick run command in multiable server, we might do this:

for host in `cat hostsfile`; do
  echo $host
  ssh $host "/usr/bin/sudo ifconfig|grep inet"

If you have less then 10 servers, it's fine, but if you have more, more and more in the future...

This is very light and make it super fast.

The only thing you need to do is like that:

in your hosts file

It's able to detect if you have different port running sshd, default is 22 if you don't add :port

package main

import (

var (
    file *string = flag.String("hostsfile", "", "use hostsfile")
    cmd *string = flag.String("cmd", "hostname", "execute command")

func main() {
    var hosts []string

    hosts = mssh.GetHostsByFile(*file)

    var conf mssh.Conf
    conf.User = "kiyor"
    conf.Key = "/home/kiyor/.ssh/id_rsa"
    conf.Command = *cmd
    mssh.Ssh(hosts, conf)
./yourbinary -hostsfile host -cmd "ifconfig|grep inet"

That's all, it will send 24 request at same time. It's lite, it's quick, you don't need full path, and support nohup.out

some option

conf.Sudo = false //option default=false                                           
conf.Debug = false //option default=false
conf.Workers = 24 //option default=24
conf.Background = false //option default=false
You can’t perform that action at this time.