开发者

PHP - changing ownership of a process while running

开发者 https://www.devze.com 2023-01-17 21:46 出处:网络
I have a PHP script that I need to run as root from the command line. After the script completes some critical operations (that require root acce开发者_如何转开发ss) I would like to change the owner

I have a PHP script that I need to run as root from the command line.

After the script completes some critical operations (that require root acce开发者_如何转开发ss) I would like to change the owner of the process to 'nobody'.

Is that possible with PHP? How can I do it?


You can change user/group ids with the following functions:

posix_setgid

posix_setuid

posix_setegid

posix_seteuid

If you need to change the group, you'll want to perform that first.


No, script cannot change ownership explicitly to root.

0

精彩评论

暂无评论...
验证码 换一张
取 消