This is a modified version of the gsh/gcp utilities that were distributed with the perl 5.6.1 distribution, originals can be found in $PERLSRC/eg/g/. The primary modification that I've made is to use ssh instead of rsh, the advantages of this should be obvious to anyone. To make best use of this modification, you would need to have shared keys setup on all hosts that will be managed with gsh and the management host. To be more secure, said key will need to have a pass-phrase. To prevent having to have to retype the pass-phrase for each gsh execution, you should run an ssh-agent. For full agent functionality, read the man page, for the purposes of this document, I'll give you a quick and dirty: [root@mon /root]# ssh-agent bash2 [root@mon /root]# ssh-add Enter passphrase for /root/.ssh/id_rsa: Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa) Identity added: /root/.ssh/id_dsa (/root/.ssh/id_dsa) You are now running bash as a sub-shell of ssh-agent. The ssh-add command adds the key to your agent, now you can execute commands on all systems in /etc/ghosts, w/o needing to type a password or passphrase again! [root@mon /root]# gsh -h work uptime work1: 2:05pm up 2 days, 3 min, 1 user, load average: 0.00, 0.00, 0.00 work2: 2:05pm up 2 days, 3 min, 2 users, load average: 0.00, 0.00, 0.00 work3: 2:05pm up 2 days, 3 min, 1 user, load average: 0.00, 0.00, 0.00 work4: 2:05pm up 2 days, 3 min, 1 user, load average: 0.00, 0.00, 0.09 work5: 2:06pm up 2 days, 3 min, 1 user, load average: 0.00, 0.00, 0.00 work6: 2:06pm up 2 days, 3 min, 1 user, load average: 0.02, 0.01, 0.00 work7: 2:06pm up 2 days, 10 min, 1 user, load average: 0.00, 0.00, 0.00 work8: 2:12pm up 85 days, 20:38, 1 user, load average: 0.00, 0.00, 0.00 work9: 2:00pm up 41 days, 22:05, 1 user, load average: 0.00, 0.00, 0.00 work10: 2:01pm up 37 days, 21:21, 2 users, load average: 0.00, 0.00, 0.00 work11: 2:00pm up 41 days, 21:58, 2 users, load average: 0.00, 0.00, 0.05 work12: 2:01pm up 41 days, 21:59, 2 users, load average: 0.00, 0.09, 0.16 If you need to pipe commands, quote the full string to be executed on the remote hosts to ensure that everything is being executed over there: [root@mon /root]# gsh -h work "ps ax | grep [l]pd" work1: 822 ? S 0:00 lpd Waiting work2: 821 ? S 0:00 lpd Waiting work3: 821 ? S 0:00 lpd Waiting work4: 822 ? S 0:00 lpd Waiting work5: 825 ? S 0:00 lpd Waiting work6: 825 ? S 0:00 lpd Waiting work7: 824 ? S 0:00 lpd Waiting work8: 822 ? S 0:19 lpd Waiting work9: 807 ? S 0:00 lpd Waiting work10: 810 ? S 0:00 lpd Waiting work11: 806 ? S 0:00 lpd Waiting work12: 806 ? S 0:00 lpd Waiting -- Michael Parson mparson@bl.org 20030814