Pages

Wednesday, June 28, 2017

Using DSH (Distributed Shell) to Run Linux Commands Across Multiple Machines

Systems Administrators know all too well the importance of being able to monitor and administer numerous machines in a short time, and preferably, with as little running around as possible. Whether it is a small cloud environment, or an enormous server cluster, the ability to centrally manage computers is essential.
DSH Commands
DSH Run Commands Across Multiple Servers
To partly accomplish this, I am going to show you how to use a nifty little tool called DSH that allows a user to run commands over multiple machines.

What is DSH?

DSH is short for “Distributed Shell” or “Dancer’s Shell” it is freely available on most major distributions of Linux, but can easily be built from source if your distribution does not offer it in its package repository. You can obtain the source at.
  1. http://www.netfort.gr.jp/~dancer/software/dsh.html.en

Install DSH (Distributed Shell) in Linux

We are going to assume a Debian / Ubuntu environment for the scope of this tutorial. If you are using another distribution, please substitute the appropriate commands for your package manager.
On Debian / Ubuntu
First, let’s install the package via apt:
$ sudo apt-get install dsh
On RHEL / CentOS / Fedora
This method is for those who are not using Debian, and want to compile it from source tar balls. First you need to compile “libdshconfig” and install.
# wget http://www.netfort.gr.jp/~dancer/software/downloads/libdshconfig-0.20.10.cvs.1.tar.gz
# tar xfz libdshconfig*.tar.gz 
# cd libdshconfig-*
# ./configure ; make
# make install
Then compile dsh and install.
# wget http://www.netfort.gr.jp/~dancer/software/downloads/dsh-0.22.0.tar.gz
# tar xfz dsh-0.22.0.tar.gz
# cd dsh-*
# ./configure ; make 
# make install
The main configuration file “/etc/dsh/dsh.conf” (For Debian) and “/usr/local/etc/dsh.conf” (for Red Hat) is pretty straightforward, but since rsh is an unencrypted protocol, we are going to use SSH as the remote shell. Using the text editor of your choice, find this line:
remoteshell =rsh
And change it to:
remoteshell =ssh
There are other options you can pass in here, if you choose to do so, and there are plenty of them to find on the dsh man page. For now, we are going to accept the defaults and have a look at the next file, /etc/dsh/machines.list (for Debian).

      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
                                                    ► Read more: http://adf.ly/1nBS1I
      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

No comments:

Post a Comment