I want apache to run a command as another user, vpopmail
First, I edited the sudoers file,
visudo
and added the following line:
apache ALL=(vpopmail) NOPASSWD: /bin/echo
Next,
ls -a
outputs
-rwx------ 5 vpopmail vchkpw 4096 Jan 20 13:05 .qmail
However, I'm getting "permission denied" when I run the following with PHP
<?
$output = shell_exec("sudo -u vpopmail /bin/echo 'XYZ' > /home/vpopmail/domains/domain.com/user/.qmail");
?>
What am I missing?