[Kc] Shell script to execute system command as another user

Andrew Moore amoore at mooresystems.com
Mon May 3 10:21:24 CDT 2004


On Mon, May 03, 2004 at 09:25:40AM -0500, Brad wrote:
> How can I set up a perl script that will be owned and executed by nobody
> (executed through apache) that will then execute a shell command as the
> user cyrus?

A popular method seems to be to use "sudo". You can give 'nobody'
permissions to run a certain command as 'cyrus', perhaps without a
password, in the /etc/sudoers file, I believe.

That seems to be better than making the shell script (or command) suid
cyrus for some reasons.

Hope it helps.

-Andy






More information about the kc mailing list