Running exec as a different user

后端 未结 4 1222
走了就别回头了
走了就别回头了 2020-12-17 15:37

Is it possible to run exec() as a a different user (on my box it runs as www-data). I wish to execute a script that needs access to files that are not owned by www-data.

4条回答
  •  悲&欢浪女
    2020-12-17 16:18

    No, not directly. If you are on a linux machine and have the rights, you can set the set the setuid bit on your file.

    Keep in mind that the webserver runs as a different user for a reason. It is a very important security mechanism and by working around it, you might cause a security vulnerability.

提交回复
热议问题