S
S
Sergey Burduzha2017-09-16 01:52:23
ubuntu
Sergey Burduzha, 2017-09-16 01:52:23

What rights to give to the /var/www folder?

Help solve the puzzle. You need to get access to files and folders, as well as the right to create folders and files in /var/www. In this regard, I found two solutions:
1 solution:
First, create a group:
sudo groupadd groupname
Then add yourself to this group:
sudo gpasswd -a username groupname
Then give the created group permission to write to the directory:
sudo chown -R root:groupname /var/www
sudo chmod 775 /var/www
2 solution:
- add the user to the www-data group
- make the owner / var/www/site - user:www-data
- give the user read / write permissions, the group write permissions to some directories that this or that CMS requires
- the final rights will look like 770/660
I just want to do everything right from the very beginning . As for me, the first option has the right to be more.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nazar Mokrinsky, 2017-09-16
@serii81

On my system, the issue is resolved even more simply: the web server is started on behalf of my user and his group (Apache2, Nginx, php-fpm).
Accordingly, all issues with the rights to files and folders are automatically resolved (including those that are created by the code in the process of work), but you need to be clearly aware of what this is fraught with in terms of security and not run dubious code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question