csshx is a tool that allows you to SSH into multiple hosts and send the same commands to them - think of the ‘Send UNIX’ command in Apple Remote Desktop, but one that actually works! Sometimes you won’t be able to have a configuration management tool in place, or perhaps you’ve been called in because what is there is broken and there are a few hundred machines that can’t talk to the server. Being able to perform commands on many machines at once lets you get these machines back into your desired state quickly.

Getting started

You can download the binary directly from the project’s website - it’s not been updated since 2011, so there’s not much fear of it becoming out of date. I am however a fan of Homebrew - a simple way of managing extra binaries on OS X. If you don’t have Hombrew already installed, follow the instructions on the Homebrew wiki.

Follow the prompts and you’ll be good to go. Once you’ve got Homebrew installed, install csshx:

$ brew install csshx

Bow before me, for I am root

Let’s say you’ve got a list of IP addresses for your machines - from your DHCP server, ARD or the excellent iNet (protip: export your scan as a CSV and only have the IP address field for an almost perfect file for csshx). You can feed the hosts file into csshx (using --hosts) and it will open up a SSH session to each of them. To specify the username, use --login.

$ csshx --hosts /path/to/some/file --login ladmin

You can then send your commands directly to the machines - if you have SSH keys set up, you don’t even need to enter a password.

csshx blog post

But you don’t need to go to the trouble of feeding in a list of host names. csshx can be given a subnet to try and connect to - combined with the --ping_test option, csshx will ping each of the IP addresses in the range and only attempt a connection to those that are actually online.

$ csshx 10.50.1.0/24 --login ladmin --ping_test

Whether you just need to force a Munki run to urgently push out an update, or if they’ve managed to get disconnected from your management tool, as long as you have SSH access to the machine, you can always get the machines back in control.

  • Email