Search code examples
phpsudo

PHP shell_exec() and sudo: must be setuid root


I have a shell_exec() command that accesses a directory above my document root so I need to use sudo "as root" to make it happen. (I understand the security issues and am putitng in measures to address it).

The issue is when I run the shell_exec() I get a "sudo: must be setuid root" error in my apache error_log file.

I thought the solution was to chmod 4750 the bash script that is called by my sheel_exec() but that does not do the job.

What exactly is "sudo: must be setuid root" trying to tell me and how might I resolve it?


Solution

  • Is the sudo executable itself setuid root? You may need to

    chown root: /usr/bin/sudo
    chmod u+s /usr/bin/sudo