T
T
tester_toster2018-04-18 08:43:58
linux
tester_toster, 2018-04-18 08:43:58

How to give access to a folder from another group to another user php-cgi + nginx?

There is a server with nginx+phpcgi
Two domains:
domen.one, path: var/www/user_one/data/www/domen_one/, user: user_one, group user_one
domen.two, path: var/www/user_two/data/www/ domen_two/, user: user_two, group user_two
There is a folder: var/www/user_one/data/www/domen_one/images
We need to enable php in domen.two interpreter to give access to this folder.
If you add user_two to the user_one group, then when checking via shell or exec, there is access to the folder, but file_get_contents() or scan_dir() give: permission denied.
How to implement the necessary functionality correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2018-04-18
@mureevms

If you add user_two to the user_one group, then when checking via shell or exec, there is access to the folder, but file_get_contents() or scan_dir() give: permission denied.

It is obvious that the rights to the group are not correct. You need to give the group permissions to files and directories:
sudo find /var/www/ -type f -exec chmod 660 {} \;
sudo find /var/www/ -type d -exec chmod 770 {} \;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question