Sudo used in web cgi scripts not working

HL Lau lauhl at
Fri Apr 27 01:40:46 EDT 2001

Hi All,

I've checked the FAQ and part of archive but found nothing.  So if this
question has been covered before, please forgive me.

I want to run some privileged commands in a web script but so far have not
been successful.  I've also tried executing the command in a bash shell and
the command runs fine in shell mode.  Here are some of the sample output in

Apr 27 11:53:04 ruby /usr/local/bin/sudo:   apache : command not allowed ;
TTY=unknown ; PWD=/home/httpd/cgi-bin ; USER=root ;
COMMAND=/usr/sbin/adduser onlinetemp

When I try it logging into the bash shell and executing the command it works
and the following is recorded in the syslogs:

Apr 27 11:50:24 ruby sudo:   apache : TTY=pts/1 ; PWD=/home/httpd/cgi-bin ;
USER=root ; COMMAND=/usr/sbin/adduser testingsudo
Apr 27 11:50:24 ruby adduser[1979]: new group: name=testingsudo, gid=745
Apr 27 11:50:24 ruby adduser[1979]: new user: name=testingsudo, uid=745,
gid=745, home=/home/testingsudo, shell=/bin/bash

What did I do wrong?  Any pointers will be much appreciated.

Best regards,

lauhl at

More information about the sudo-users mailing list