Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run script to add remove email users.

Status
Not open for further replies.
May 13, 2005
56
US
Hi All,

I am running Scalix email server and I am looking for a way to build a web interface to add and remove users (this would be much like the way one would add and remove linux users).

I have set the apache user to have rights to run the program in the /etc/sudoers file.

While apache came with /sbin/nologin in the /etc/passwd file, I changed that to test to /bin/bash and I was able to add / remove users with the command "sudo omaddu"
omaddu = add users in scalix system

My web page script looks like this

Code:
<?
$output=`/var/[URL unfurl="true"]www/html/test`;[/URL]
echo "<pre>$output</pre>"
?>

That calls this file

test
Code:
#!/bin/bash
sudo omaddu -n test/mail -p pass

If I run the test script from the apache temp login it runs fine.

I have looked at the /var/log/http/error.log and it looks like the file is requesting a password as the last line just says Password:

I have no password for these command set in the sudoers file and like I mentioned, it works from bash?

Any ideas?
 
Did you try adding a NOPASSWD directive in your sudoers file?

 
yes, I mentioned that horribly at the end of my description.

My sudoers enrty looks like this.

Code:
Cmnd_Alias OMADDU = /opt/scalix/bin/omaddu
%group  ALL=(ALL) NOPASSWD: OMADDU

the group has the apache user in it, and it does not ask for a password when I su to apache and run it,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top