automating commands on nodes

Jakob Østergaard jakob at ostenfeld.dk
Sun Jun 4 16:23:44 PDT 2000


On Sun, 04 Jun 2000, Peter Jay Salzman wrote:

> dear all,
> 
> i'd like to:
> 
> edit /etc/profile to include /sbin and /usr/sbin in PATH
> adduser jobrun
> 
> on our 40 nodes.  is there a way of doing this without telnetting 40 times?

If you haven't already, you should setup SSH on all the nodes.  Then you can
put your public key in ~root/.ssh/authorized_keys  to allow instant login from
anywhere provided your passphrase is entered correctly at your workstation.

If you don't know about SSH, Secure Shell, you should read about it (good
pointers anyone ?)

Once you've done that, it should be a simple matter to do what you asked:
Provided the names of all your hosts are in the file /etc/hostfile:

[start up a shell under ssh-agent, type in passphrase to ssh-add]

for i in `cat /etc/hostfile`; do
  ssh -l root $i perl -pi -e 's/(PATH=\"[^"]+)\"/$1:\/usr\/sbin:\/sbin\"/' /etc/profile
  ssh -l root $i adduser jobrun
done

You might want to experiment with copies of /etc/profile when doing tricks
like that....   This time I actually managed to get it right at first shot,
but your mileage might vary  ;)

-- 
................................................................
: jakob at ostenfeld.dtu.dk  : And I see the elder races,         :
:.........................: putrid forms of man                :
:   Jakob Østergaard      : See him rise and claim the earth,  :
:        OZ9ABN           : his downfall is at hand.           :
:.........................:............{Konkhra}...............:




More information about the Beowulf mailing list