virtualsue has asked for the wisdom of the Perl Monks concerning the following question:
scriptname does lots of things...then:sudo scriptname -a opt1 -b opt2 -w host1, host2, host3
This works OK when a human is in charge. They enter their password when they start the process, then for every host that the program needs to update. But now we also need to do this automagically, via cron. One condition is that root not be used for this task, as this would require setting up ssh keys for the root user. I can think of 2 ways to accomplish this in a way that won't have a large impact on the existing code. Assume a special user is created and ssh keys set up for all the hosts ever accessed, and then:foreach $dest (@dests) { system /usr/local/bin/ssh -l <user> -i <user's ssh identity> -t $de +st sudo scriptname + opts }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Running Perl program w/root privs via cron
by Corion (Patriarch) on Jun 08, 2002 at 19:42 UTC | |
by virtualsue (Vicar) on Jun 09, 2002 at 09:44 UTC | |
Re: Running Perl program w/root privs via cron
by atcroft (Abbot) on Jun 08, 2002 at 19:35 UTC | |
Re: Running Perl program w/root privs via cron
by Anonymous Monk on Jun 09, 2002 at 06:00 UTC | |
by virtualsue (Vicar) on Jun 09, 2002 at 11:03 UTC | |
Re: Running Perl program w/root privs via cron
by thraxil (Prior) on Jun 08, 2002 at 20:16 UTC | |
Re: Running Perl program w/root privs via cron
by greenFox (Vicar) on Jun 09, 2002 at 06:14 UTC |