in reply to Re: sudo from Apache
in thread sudo from Apache

You don't need a password for www-data. sudo can be configured to allow one or more users to run one or more commands without any password. See the sudo documentation, especially man 5 sudoers.

A line from my /etc/sudoers file, allowing every user to run the two scripts /service/fetchmail/wake and /service/fetchmail/status:

%users ALL = NOPASSWD: /service/fetchmail/wake,/service/fetchmail/sta +tus

Replace %users with www-data and only the user www-data is able to run the scripts.

Replace the script names with some other script names and obviously, the other scripts can be executed without entering a password.

Combine both and www-data can run a mount script and a umount script that call the mount and umount commands with fixed parameters.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)