Linux.com

Home Linux Community Community Blogs General Linux Using a Distributed Shell (dsh) to Administer Multiple Workstations

Using a Distributed Shell (dsh) to Administer Multiple Workstations

Introduction

This is something I used to need a lot, that I dug out of my documentation to share.  These are steps to using dsh on ubuntu to administer multiple workstations.  This does not include instructions for setting up public/private key authentication in ssh, but these instructions work the best when this has been setup.  If you don't setup ssh keys, you'll end up having to type the root password for each machine you ssh into.

Setup

Installation

On Ubuntu, run this to install:

sudo aptitude install dsh

 

Configuration

Start by creating a new group of workstations.  I have several CentOS workstations, so I create a new file that contains all of these:

/etc/dsh/group/centos-workstations

# These are standard workstations conforming to the typical centos configuration
root@host1
root@host2
root@host3

Running Commands

You can run pretty much anything, but here's an example:

dsh -g centos-workstations yum clean all
dsh -g centos-workstations yum -y upgrade

Some Shortcuts

I simplify matters even more by creating an alias

alias cent='dsh -g centos-workstations'

I add this to my .zshrc file.  This buys the the ability to run things like:

cent yum -y upgrade

Conclusion

I realize these instructions are a bit basic, but I hope it points out new possibilities to those who have never used dsh before.  I have found myself using this pretty extensively with about 50 workstations and publickey authentication and it works wonderfully.  I found it especially useful a year or more ago when I was trying to modify 50+ workstations to conform to a more standard configuration.  I tried several other solutions over a year ago (parallel ssh or something like that) and I didn't find anything quite as nice as dsh.

 

 

Comments

Subscribe to Comments Feed

Upcoming Linux Foundation Courses

  1. LFD320 Linux Kernel Internals and Debugging
    04 Aug » 08 Aug - Virtual
    Details
  2. LFD405 Embedded Linux Development with Yocto Project
    04 Aug » 07 Aug - Santa Clara, CA
    Details
  3. LFD312 Developing Applications For Linux
    18 Aug » 22 Aug - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board