Answer the question
In order to leave comments, you need to log in
How to set permissions for linux user and www-data?
chown -R www-data:www-data folder gave permissions
folder is in the root of the user.
The user does not have access to folder
I understand that ideally you need to throw the user into the www-data group and use 775 and 664 permission settings.
But at creation by one user of a file. 644 is generated and www-data has no rights. Also and vice versa.
I see that on hosting, we go under the user and edit files and in parallel www-data can edit them.
How to do this locally?
Answer the question
In order to leave comments, you need to log in
On hosting, the web server also works with user rights. If it's Apache use apache2-mpm-itk if it's Nginx+php-fpm then configure php-fpm accordingly.
Access via FTP is also carried out with the rights of this user.
SSH/SFTP access too. Well, you understand. That's the whole secret.
Everything is correct about the user user in the www-data group.
Now you need to set the correct umask for the user user.
So that when creating a file, the rights are set to 0664.
The basic rights for directories are 0777 (rwxrwxrwx) and for files 0666 (rw-rw-rw).
umask allows you to create rights when creating for each user separately.
Example of creating a file with mask 0022:
Default permissions: 0666
Subtracted umask value: 0022 (-)
Final rights: 0644
To get the correct permissions, you need to set the mask to 0002
Example of creating a file with mask 0002:
Default permissions: 0666
Subtracted umask value: 0002 (-)
Final rights: 0664
Usually on hosting this is solved by using one uuid for the user and www-data (for the system they stop being different)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question