pssh to manage multiple systems

pssh (Parallel SSH) is a powerful tool if you need to manage multiple boxes. Originally developed by Brent Chun, it’s now maintained by Andrew McNabb.


Depending on your distro, you probably have pssh available in a repository of some sort. I know there’s a new version in the Fedora 12 yum repository and lots of binaries in RPM format.┬áSince I was playing with a CentOS 5.4 installation, and pssh isn’t in the default repositories, I chose to grab the source from the new project home.

pssh is written in Python. Now, I don’t know the first thing about Python, but using made the build and install exceedingly painless. (Follow the INSTALL notes in the tar file.)

Install setuptools, extract the source, and then build it:

$ wget ''
$ python
$ tar -xvf pssh-2.0.tar.gz
$ cd pssh-2.0
$ python install

This will install the utilities to /usr/bin


$ pssh --help

usage: pssh [OPTIONS] -h hosts.txt command [...]
--help show this help message and exit
hosts file (each line "host[:port] [user]")
-l USER, --user=USER username (OPTIONAL)
-p PAR, --par=PAR max number of parallel threads (OPTIONAL)
-o OUTDIR, --outdir=OUTDIR
output directory for stdout files (OPTIONAL)
-e ERRDIR, --errdir=ERRDIR
output directory for stderr files (OPTIONAL)
-t TIMEOUT, --timeout=TIMEOUT
timeout (secs) (-1 = no timeout) per host (OPTIONAL)
SSH options (OPTIONAL)
-v, --verbose turn on warning and diagnostic messages (OPTIONAL)
-A, --askpass Ask for a password (OPTIONAL)
-P, --print print output as we get it (OPTIONAL)
-i, --inline inline aggregated output for each server (OPTIONAL)


Create a hosts file for pssh to act on.

$ more pssh_hosts.txt
# host[:port] [user] glen glen


$ pssh -h /home/pssh_hosts.txt -P date Wed Dec 30 03:44:40 GMT 2009
[1] 22:44:24 [SUCCESS] Wed Dec 30 03:42:22 GMT 2009
[2] 22:44:24 [SUCCESS]

I’m not sure if I like the output from -P or -i better. I’ll have to play with both for a while.

To redirect the output to a file, use the -o switch and give it a directory name. In the output directory will be files, named after each of your targets, containing the command results.

There is some old documentation still available at Brent Chun’s original site, but it could be out-dated. I know the binary install location has changed and the --help switch has the newer options.

While playing with the 2.0 version from the Fedora 12 repo, I noticed the pscp command is now pscp.pssh. I couldn’t find any reference to why the change was made. The source I built from has the original pscp command. (Update: I came across this comment referring to a name-clash with PuTTY’s scp utility.)


pssh assumes you have publickey–no password entry–access to all the machines you’re managing. To set that up, take a look at this.