===== Distributed parallel appliance of system settings to multiple hosts ===== === Problem === Run stupid administrative tasks in parallel on multiple machines. === Solution === Use "**parallel-ssh**" (former "pssh")! * Get it: * aptitude install pssh * [[http://code.google.com/p/parallel-ssh/]] * [[http://www.theether.org/pssh/]] (old site) * Read about it: * [[http://www.theether.org/pssh/docs/0.2.3/pssh-HOWTO.html|pssh HOWTO]] * [[http://www.linux.com/archive/feature/151340|Parallel SSH execution and a single shell to control them all]] * [[http://www.linux-magazin.de/Heft-Abo/Ausgaben/2008/11/Und-wenn-ja-so-viele|Aus dem Alltag eines Sysadmin: Parallel SSH]] === Example usage === Modify setting ''%%ALLOW_SSH_ROOT_USER=without-password%%'' in ''/etc/rkhunter.conf'' on multiple machines: #!/bin/bash cmd="perl -pi~ -e 's/ALLOW_SSH_ROOT_USER=yes/ALLOW_SSH_ROOT_USER=without-password/' /etc/rkhunter.conf" parallel-ssh --par 1 --hosts hosts-file --user root --inline $cmd < /dev/null We had to use ''%%--par 1%%'', since the parallel execution of multiple ssh logins lead to some attempts being not successful. Maybe this is an issue with ''ssh-agent''. The issue about redirecting ''STDIN'' to ''/dev/null'' is described here: [[http://code.google.com/p/parallel-ssh/issues/detail?id=4|Issue 4: pssh cannot be used from a script?]] === Other parallel shell solutions === * [[http://bashcurescancer.com/dssh-executing-an-arbitrary-command-in-parallel-on-an-arbitrary-number-of-hosts.html|dssh – executing an arbitrary command in parallel on an arbitrary number of hosts]] * [[http://clusterssh.sourceforge.net/|ClusterSSH]] * [[http://clusterit.sourceforge.net/man/dsh.html|dsh - run a command on a cluster of machines]] (via [[http://clusterit.sourceforge.net/|ClusterIt]]) * [[http://atlanticlinux.ie/blog/?p=128|Even more "parallel ssh" solutions...]] {{tag>openssh distributed parallel}}