Answer the question
In order to leave comments, you need to log in
How to properly set the rights to the site directory in order to conveniently work with it locally?
It's not the first week I've been suffering with the distribution of rights.
I use a bunch of nginx, php-fpm.
I would like to create a separate directory with a site in which I can work as a home user and view the result on a local machine. The problem is that if I create a file under my user, it gives out Permission denied
when viewed through the browser, if I transfer ownership to the nginx user, then I cannot edit this file. Assigning rights to 776 seems wild to me.
======== I will describe the structure ========
/etc/nginx/nginx.conf
Completely standard, the user is in it nginx
.
/etc/nginx/conf.d/joomla.test.conf
Here I have a host for the local domain joomla.test
.
/etc/php-fpm.d/www.conf
Everywhere (in 4 places) specified user and group nginx
.
/etc/share/nginx/joomla.test
folder of my site public_html
- site root error.log
, access.log
- nginx logs
======== End of structure ========
I can, specify user Antonov:nginx with rights 750, and everything seems to be working, but it's not convenient to control the rights and SELinux labels (which are set by chcon). And still, sometimes nginx swears because it cannot enter any of the folders and you have to do 755 for the folders, as if there is some third user involved (like root).
How can I set the rights so that working under my user Antonov:Antonov and not having to change the mode, owner and group of files every time? And how in general it is correct to distribute the rights? Whether it is possible to adjust so that everything worked at the rights in 700?
Answer the question
In order to leave comments, you need to log in
Correct option:
1) Disable SELinux altogether.
2) Create a dev group: sudo groupadd dev
2) Reduce the nginx and Antonov users (and generally everyone who needs access to this file subtree) to the dev group, as Yar Rick already mentioned , with the command:
sudo usermod -aG nginx dev
sudo usermod -aG Antonov dev
sudo find /etc/share/nginx/joomla.test -type d -exec chmod 2775 {} \;
sudo find /etc/share/nginx/joomla.test -type f -exec chmod g+w {} \;
For local use (development/debugging), it's easiest to run Apache/nginx as the user you're running as.
I will add Vitsliputsli
on the sale, it is normal to have rights 755/644 or 750/640
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question