views:

62

answers:

2

If I want to have, say, a PHP application update one of my config files in /etc, is there a generally agreed-upon best way to do that?

What I specifically want to do is to have Drupal update /etc/postfix/virtual. My app has a certain list of users and I want each one of those users to be under an alias because I want [email protected] to forward to each one of my users. Maybe there's a better way to do that than to have my app write to my Postfix config file. I don't know.

Any advice would be greatly appreciated.

Thanks, Jason

A: 

You can't; or rather, you can, but you really shouldn't, as it would involve giving the web server user access to secure files (i.e. /etc).

Instead, you should build Postfix with MySQL support and have Drupal update that database.

Mark Trapp
+1  A: 

You can create an alias inside /etc/aliases like the line below.

drupal: :include:/var/www/drupal/users

File /var/www/drupal/users includes all your email addresses, one line per address. Then sending to [email protected] will send to all addresses in the file.

z1x2
This worked perfectly. Thank you. If anyone comes across this and is new to /etc/aliases, you should know that you have to run "newaliases" after changing this file (but you don't have to run newaliases after updating /var/www/drupal/users).
Jason Swett