[英]shell_exec | allow specific program to run under apache user
can i run specific command/program like x server that need root privileges using shell_exec from php. 我可以使用php中的shell_exec运行需要root特权的特定命令/程序,例如x服务器。 i just want to run x server program from php shell_exec().
我只想从php shell_exec()运行x服务器程序。 note: php is running under suphp, OS is centos.
注意:php在suphp下运行,操作系统为centos。
Take a look for SUID und SGID on Unix Files 看看Unix文件上的SUID和SGID
SUID stands for Set User ID. SUID代表设置用户ID。 This means that if the SUID bit is set for any application then your user ID would be set as that of the owner of application/file rather than the current user, while running that application.
这意味着,如果为任何应用程序设置了SUID位,则在运行该应用程序时,您的用户ID将被设置为应用程序/文件所有者的用户ID,而不是当前用户的ID。 That means in case I have an application whose owner is ' root ' and it has its SUID bit set, then when I run this application as a normal user, that application would still run as root.
这意味着如果我有一个所有者为“ root”的应用程序,并且该应用程序的SUID位置1,那么当我以普通用户身份运行该应用程序时,该应用程序仍将以root身份运行。 Since the SUID bit tells Linux that the the User ID root is set for this application and whenever this application executes it must execute as if root was executing it (since root owns this file).
由于SUID位告知Linux该应用程序已设置了用户ID根目录,因此只要该应用程序执行,它就必须像root正在执行它一样执行(因为root拥有此文件)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.