I need to run a cPanel script from the command line via PHP's exec function (other cPanel options are not viable). The command is roughly:
uapi --user=[user] Email suspend_incoming email=[user]%40[domain].[tld]
I was getting the following error:
setuids failed: Attempting to setuid as a normal user with RUID ***
That in turn led me to realize that the user under which PHP runs does not have permission to execute that command which lead me to this thread. However just as you're not supposed to CHMOD files blatantly as 777 I don't want to blindly enable all commands for this user when using sudo from the command line or PHP's exec script.
How do I only allow the uapi command (also multiple specific commands) to be executed by this user when using sudo via an edit to the sudoers file?