emil.isberg at mds.mdh.se
Wed Dec 11 05:37:17 EST 2002
On Wed, 11 Dec 2002, Kirk Bailey wrote:
>I want to be able to add and delete email lsits to my email system. This
>means adding and deleting alias definitions to the aliases file in
>/etc/mail, and then running the newaliases command. To do this, the web
>server must run a program, a script. This is exeuted in my freebsd server
>as nobody. How may I accomplish this task?
I don't think sudo is what you are looking for...
I would set it up as several alias-files from the MTAs point of view and
then make sure that the right one is writeable by nobody (or a specific
user for the web-mail-handler-stuff).
Sendmails newaliases is runable by any user (including nobody) so you
should be able to run it from whatever script there is...
Else you might want to create a setuid application that only does an
append on a certain file and then calls newaliases.
How about the following? (Some checks on alias and stuff needs to be
added... Either here or before this program is called.)
#define MAX_LEN 1024
int main(int argc, char *argv)
if (argc!=3 || !argv || !argv)
printf("Usage: <addalias> <alias> <target>\r\n");
if (len > MAX_LEN)
if (!(fp=fopen("/etc/mail/mywebaliases", "wt+"))
/* Make sure that newaliases is in the path. */
execlp("newaliases", "newaliases", NULL);
/* If we get here then I failed to find newaliases. */
puts("Couldn't find and execute newaliases.");
Before destruction a man's heart is
haughty, but humility goes before honour.
-- Psalms 18:12
More information about the sudo-users