mussh-run-commands-on-multiple-hosts

2022-03-06 1 min read Learning Bash Fedora SSH

mussh allows you to run command/commands on multiple hosts at the same time. If you have farm of server setup with passwordless ssh or with same password (which is generally the case), then using mussh you can either check all the servers for some output or fix something or maybe update all the packages. How cool is that :)

Here is description of this package from dnf repo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Name         : mussh
Version      : 1.0
Release      : 18.fc35
Architecture : noarch
Size         : 20 k
Source       : mussh-1.0-18.fc35.src.rpm
Repository   : fedora
Summary      : Multihost SSH wrapper
URL          : http://www.sourceforge.net/projects/mussh
License      : GPL+
Description  : Mussh is a shell script that allows you to execute a command or
             : script over ssh on multiple hosts with one command. When possible
             : mussh will use ssh-agent and RSA/DSA keys to minimize the need to
             : enter your password more than once.

ssh – host hopping (with Jump host)

2018-08-20 1 min read Linux

Most of the times I need to jump hosts with ssh. What do I mean by that. Let me try to explain :

Host Hopping

If I need to got to host h3 then I need to first login to h1 and from there to host h2 and finally to host h3. This can be done with .ssh/config file but for that I need to have some program like nc installed on all the hosts in between which might not be practical in all cases. So, here is something that I found very useful.

Continue reading

Send history of current host to some other host over ssh

2018-02-26 1 min read Fedora Learning

Sometimes I want to save the history of current host on another host. This is to ensure that I can use copy/paste on other host to run the commands. To this, I found a simple solution –

history| ssh <user>@<host> 'cat - > /tmp/history'

And on the new host, you can find the history in file “/tmp/history”, cool :). Now I can quick edit this file to create this as shell script as well if required. How cool is that.

Continue reading

ssh – remove offending key.

2016-04-04 1 min read Linux

Whenever a system/server is re-installed or the host key changed for any reason, you would have seen the “host key verification failed”. And as usual you would have to go to known_hosts file and delete the offending key. I will show you 2 simple ways to do this here.

The output that you get in such scenario is:

Offending ECDSA key in ~/.ssh/known_hosts:4

First, you can use sed to directly delete the offending key with a command like this :

Continue reading

Executing commands on multiple hosts

2015-09-21 1 min read Fedora Learning Linux

If you have to execute the same command in multiple hosts, then you can use mussh:

Description : Mussh is a shell script that allows you to execute a command or script
over ssh on multiple hosts with one command. When possible mussh will use
ssh-agent and RSA/DSA keys to minimize the need to enter your password
more than once.

First install mussh with the following command

dnf install mussh

Now to run this for multiple hosts, you can run like this

Continue reading
Older posts