13

Is there any alternative to Clusterssh, pssh etc, to manage multiple ssh based servers through one interface?

One weakness in Clusterssh is that my servers use key based authentication, with passhprase to login, and there is no way to login to servers using the private key.

Is there any alternative available which supports authentication with Private keys?

5
  • What is your problem with pssh? Do you need parallel or just a program to manage multiple SSH servers?
    – quanta
    Aug 28, 2012 at 14:41
  • i actually need to see the Real-time output of few type of commands that i run on the servers. just like Cluster-ssh does.
    – Farhan
    Aug 28, 2012 at 14:54
  • 2
    Take a look at pssh's -P option.
    – quanta
    Aug 28, 2012 at 14:57
  • 2
    @Farhan why you don't use ansible?
    – c4f4t0r
    Jun 17, 2015 at 21:37
  • 1
    Cluster ssh has no problem using keys for authentication, you can use -o to pass arbitrary options to ssh: cssh server-one server-two -o '-i the-key-file'.
    – cababunga
    Sep 3, 2020 at 21:47

8 Answers 8

7

Take a look on Rundeck - http://rundeck.org/

1
  • it seems good but i am badly stuck at ADDING The nodes to it. is there a simple way to add servers to it? as it only accepts specific xml pattern based files for nodes to be added :(
    – Farhan
    Aug 28, 2012 at 14:20
9
  1. Fabric

    Define your tasks first:

    from fabric.api import *
    
    @parallel
    @hosts('192.168.3.118', '192.168.6.142')
    
    def hostname():
        run('hostname')
    

    Then executing via the fab command-line tool:

    $ fab -f /path/to/.py/file hostname
    [192.168.3.118] Executing task 'hostname'
    [192.168.6.142] Executing task 'hostname'
    [192.168.6.142] run: hostname
    [192.168.3.118] run: hostname
    [192.168.6.142] out: SVR040-6142
    
    [192.168.3.118] out: SVR040-3118.localdomain
    
    
    Done.
    
  2. Gnome Connection Manager
  3. PAC Manager
5

You can go whole hog and install a configuration management system like Puppet or Chef. You haven't mentioned how many nodes you're actually trying to manage, so this might be overkill, but, certainly, you can centrally control a lot of machines this way. If you're small right now, but are growing, you may also want to set up, say, Chef, before you get that much bigger.

If you need to run ad hoc commands over a specific set of nodes, you can do something like knife ssh 'roles:webserver' 'hostname' (knife is the command line tool for chef) to run the hostname command for all nodes that have the webserver role.

2
  • i have about 15-20 server.i already have puppet with me, but i need real-time interaction with all ssh terminals for some tasks.
    – Farhan
    Aug 28, 2012 at 14:41
  • Ah, OK. I guess puppet doesn't have an ssh facility.
    – cjc
    Aug 28, 2012 at 14:43
4

I use expect scripts to automate the logins (especially because I have to pass through a jumb box and enter in a chroot and lots of passwords must be entered) and did some "tweaks" to the config of cssh. So, I have this "main script" in my bin folder that given a "server name/alias" it takes me into the server that I want and where I want.

In the ~/.clusterssh/config I've set the "ssh" parameter to point to my script, also "ssh_args" must be set to some innocuous/fake arg, that's because cssh has it's default args list, if left empty actually the default list will end up being to the script.

So the script (in each window/terminal) will receive this args and 1 of the args given to the cssh, the script it recuperates from a file for the given server the credentials set and the steps that it must do in order to arrive where I want, then it calls the "expect code" with all that data.

~/.clusterssh/config

ssh=/home/user/bin/qs.sh
ssh_args=-a 

qs.sh

#!/bin/bash
export PATH=~/bin:$PATH
shift
case $1 in
q4|q5|q6|q7|q8|q9)
    essh user1@axt$1 
    ### essh it's some little bash script that does the things I said before and in the end it launches the expect 
    ;;
q1|q2|q3)
    essh axtr@axt$1
    ;;
*)
    echo "GOOH"
esac

so I usually call it with something like this

# cssh q4 q5 q6 q7

it's working also with "cluster aliases" having the cluster "qAll q4 q5 q6 q7" I can call with cssh qAll

Hopes it helps anyone else.

4

I prefer shmux for executing the same command on many hosts in parallel.

2

You should also look at MCollective, which is probably the best and most flexible way to interact with multiple servers in real-time. It is a bit of an undertaking to set up correctly and may be a bit over the top for your needs, but it certainly beats pssh, Clusterssh and all other SSH-based solutions. And once you have it in place there is probably nothing you can't do with it, provided you know a bit of Ruby.

1
  • Disclaimer: MCollective is from puppetlabs.
    – sjas
    Mar 23, 2015 at 10:48
1

I have asked myself the same question, since I found clusterssh's dependence on X11 or XQuartz on Mac OS X annoying, and on top of that the terminal windows opened by clusterssh looked uglier than those in Terminal.app

That's how I stumbled upon a tmux-based script from Joerg Jaspert on his blog: http://blog.ganneff.de/blog/2013/03/tmux---like-screen-just-nicer.html

Basically you type tm ms HOST1 user@HOST2 and it opens a session with one tmux window consisting of two panes

0

The bash prompt works for simple things:

make a list of servers in servers.txt, one line per server.

then do:

$ while read $server; do ssh user@$server "command args"; done < servers.txt
1
  • 1
    i want an Interactive way to use all servers. bash cant help in that case. Cluster ssh works best in that case, but its limited.
    – Farhan
    Aug 28, 2012 at 13:55

Not the answer you're looking for? Browse other questions tagged .