[SunHELP] Remotely executing scripts

Wesley A. Wannemacher wesw at aol.net
Mon Feb 4 11:42:19 CST 2002


On Mon, 4 Feb 2002 11:08:51 -0500, "Simoncini, Matthew" <simoncim at bsci.com>
wrote:> Good morning,
> 
> I've written a script that I would like to run on multiple remote Solaris
> 2.x servers with all the output written to one central server. I wrote the
> script to search for specific patches to see whether a given system has them
> applied or not. I haven't had a ton of experience executing scripts on
> remote hosts, so I'm having some difficulty getting this to work. Has anyone
> ever done this before or know of any "best methods" for getting this
> particular job done?
> 
> Thanks.
> 
> Matthew Simoncini
> Unix Admin
> _______________________________________________
> SunHELP maillist  -  SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp

I have some experience doing this sort of thing ;)

I would suggest using ssh and RSA authentication. You can generate blank
passphrases, so that you won't be prompted, then create a shell script from the
central machine that simply runs the script you created and redirects output to
the file you want to store centrally.

Step - by - Step

as the user who will run the script from the central server:
ssh-keygen (accept the blank passphrase)
then copy the contents of the file ~/.ssh/identity.pub to the remote machines in
the file ~/.ssh/authorized_keys in the home directory of the user who will be
running the script.

Test this by 'ssh'ing to the machine and logging in as the user who will run the
script: ssh -l remote_user remote_server

you should get logged in without getting prompted.

Next write a script that has one line for server you want to run the script on:
ssh -l remote_user remote_server command_to_execute >> central_log_file.date

Then try running the script. It may be necessary to get more detailed then
above, but this is the quick hack to get things working. If you need something
more specific, please let me know.

-- 
Wesley Wannemacher
Email:          wesw at aol.net
Office:         614.538.3264
Pager:          877.236.2892
Operations Analyst
CompuServe Interactive Services, Inc.

[demime 0.99c.1 removed an attachment of type application/pgp-signature]



More information about the SunHELP mailing list