Re: [SLUG] better way to consolidate shell commands

From: Eben King (eben1@tampabay.rr.com)
Date: Thu Aug 19 2004 - 19:15:32 EDT


On Thu, 19 Aug 2004, Mike Branda wrote:

> > for number in `seq 1 123` ; do
> > machine=192.168.3.$num
> > command='df -h'
> > echo attempting to ssh to $machine as root
> > ssh root@$machine "$command"
> > done

Mistake: "number" in one place, "num" in another. But you found that.
As you see, this is untested. :-)

> Usually I do the ssh as a user since my user shares an rsa key also.
> However, sometimes I have to remove privileged temp files, do an
> occasional reboot of the systems, or other things that need root priv's.

Log in as "nobody" usually and only change it to root as necessary.

Extra credit:

Modify the script so it takes an argument -- which remote user to become.

Aw heck:

#! /bin/sh
remuser=$1
...
  echo attempting to ssh to $machine as $remuser
  ssh $remuser@$machine "$command"
...

> I'll check that google group out too.

I bet your ISP provides a news server (guess: news.isp.com; guess #2:
nntp.isp.com; guess #3: news-server.isp.com). Google doesn't cache
everything, and what they do cache takes several hours to appear. It is a
great way to search or catch up, however.

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
VIRGO:  All Virgos are extremely friendly and intelligent - except
for you.  Expect a big surprise today when you wind up with your
head impaled upon a stick.  -- Weird Al, _Your Horoscope for Today_

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:01:58 EDT