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

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Rob Krul

Rob is an avid user of Linux and Open Source Software, with over 15 years experience in the tech geek universe. Aside from experimenting with the many flavors of Linux, he enjoys working with BSDs, Solaris, and OS X. He currently works as an Independent IT Contractor.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

29 Responses

  1. Aurelien says:

    dsh is the ancestor, pdsh improved it and is much better, and clustershell is now a better pdsh. Available in EPEL (CentOS , Fedora) and Debian and ubuntu http://clustershell.readthedocs.io/

    • Ravi Saive says:

      @Aurelien,

      Thanks for informing us about clustershell, we will definitely test run right away and write a detailed article on this, till then stay tuned..

  2. Marin Todorov says:

    For those of you who are asking about ports, I can suggest setting up config file in ~/.ssh/config. The file should contain something like:

    Host server1.net
    HostName 192.168.0.100
    user root
    Port 22
    IdentityFile ~/.ssh/your_id
    Host server2.net
    HostName 192.168.0.101
    User root
    Port 12345
    IdentityFile ~/.ssh/your_id
    Host server3.net
    HostName 192.168.0.102
    User root
    Port 54321
    IdentityFile ~/.ssh/your_id

  3. burning_daylight says:

    There is also tool , called cssh — it will work on any distro without “modern” libraries

  4. Norm says:

    An alternative that come standard with Red Hat and Fedora is pdsh, installable with yum/dnf

    yum install pdsh

    https://pdsh.googlecode.com/

    • Ravi Saive says:

      @Norm,

      Thanks for informing us about that pdsh took, let me give a try and see how it is useful than dsh, will test it and write a detailed article on this, till then stay tuned..

  5. Dave says:

    -c does not mean “command”:

    –concurrent-shell | -c
    Executes shell concurrently.

  6. Dustin says:

    err: [email protected]:port (not IP at the end… No undo)

  7. Dustin says:

    Try putting [email protected]:ip in the group or list file and see if it will find the proper port for your instance.

  8. Shaheel says:

    Hi,

    I have 3 machines in machinelist. but i can’t enter ssh key phrase for first and second, first and second asking key

    dsh -aM -c uptime
    [email protected]’s password: [email protected]’s password: [email protected]’s password:

    only can enter 3rd server password

  9. Shaheel says:

    How can use this with other SSH ports than 22. this only works with ssh port 22. How can use this with other ports

  10. thanks , very usefully ,

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.