[TriLUG] running script as mail alias, script running as specific user

Mike McLean mamclean at eos.ncsu.edu
Tue Jan 15 13:56:02 EST 2002


Jon Carnes wrote:
> 
> I'm trying to setup an automated process using a email address.  The email
> alias is something like:
>   thetrees:  "|/usr/local/sbin/thetrees"
> 
> The script thetrees in /usr/local/sbin needs to run as a specified user.
> The user should be "lorax".  How do I let the lorax speak for thetrees?
> 
> I've tried using chmod u+s on the script, and setting the user to lorax, but
> that is not working.
> 
> I've setup scripts to run as specific users in the past, so I know that it
> can be done.  But right now, I'm just sitting here knitting thneads and
> coming up blank.  <If I don't get this done soon, the Barbaloots will be in
> trouble...>

suid bit is ignored for scripts by design i think

I think I once accomplished this by using #!/bin/su -someargs
But this would only work if the originating user was root.

Or you could wrap the script with another script that says su user -c
"/usr/.../thetrees"
Again this would require the originating user to be root.



More information about the TriLUG mailing list