Fw: Re: problem with script execution

Alex Zbyslaw xfb52 at dial.pipex.com
Fri Dec 1 07:29:06 PST 2006


Ray Still wrote:

>>> Just out of curiosity: What is the "echo * |" supposed to do? From my
>>> point of view the shell will expand "*" to the list of files and
>>> directories in PWD, so "echo *" acts like a simple ls in this context.
>>> This list is piped to sudo. But what does sudo do with these?
>>
>>
>> sorry, I didn't want to show my passwords, so I replaced it with an 
>> astrix. the password of course is being read from the pipe by sudo 
>> because of the -S option.
>
Probably nothing to do with your original problem, but you do know that 
you can allow sudo to execute certain commands without a password?  
Passwords in shell scripts isn't exactly ideal...

E.g. my sudoers has:

Cmnd_Alias      HEALTHD = /usr/local/sbin/healthd
[...]
%wheel  ALL=(root)      NOPASSWD: SMART_STATUS, HEALTHD, MBMON

So anyone in group wheel (me :-)) can excecute any of the named commands 
without any password.  You can also force the flags that will be passed 
- the sudoers man page has more details.

--Alex






More information about the freebsd-questions mailing list