I want to execute php-fpm (7.2) with another group while staying in the original groups.
Currently php-fpm runs with www-data as user and group. I've created a new group ( testgrp ) and added the user www-data to the group.
www-data has gid: 33
testgrp has gid: 144
For a spawned PHP-process, /proc/PID/status
gives me:
Uid: 33 33 33 33
Gid: 33 33 33 33
Groups: 33 144
which shows that php runs with www-data as user and main group, but is also in testgrp .
When I set group = testgrp
in /etc/php/7.2/fpm/pool.d/www.conf
, I get:
Uid: 33 33 33 33
Gid: 144 144 144 144
Groups: 144
so php runs with testgrp as only group.
Is there a way to change the executing group without loosing the membership of www-data ?
So after looking into the source-code of php-fpm, I found the solution:
I had to add the user www-data to the www-data group (again).
Even though www-data is the primary group of user www-data , it has to be assigned in /etc/group
, because php-fpm uses the groups from /etc/group
+ the provided group while ignoring the primary group.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.