1

My /var/www is this (permissions 755)

drwxr-x---  3 www-data www-data 4096 gen 11 16:27 www

My /var/www/html is this (permissions 755)

drwxr-xr-x  2 www-data www-data 4096 gen 11 16:27 html

NOTE: if it's important, I installed php 7.2 and nginx on a Ubuntu 16.04.5; that for say that I manually created /var/www and /var/www/html because not created from nginx's installation

My user is named mirko

And using command group mirko I can see I am member of www-data

mirko : www-data adm cdrom sudo dip plugdev lxd lpadmin sambashare

But I cannot write files in /var/www/html. Of course, it because of 755 permissions.

question: the 755 is the suggested permission for /var/www/html in a lot of tutorials; but in this way, how is supposed I manage file into this folder?

My user must be able to run a composer create-project for example, and also git pull and so on.

What's the right settings for shell user and folder?

I know I can simply add +w recusively. My question was: if suggested permissions for html folder is 755 (or even 750) and suggested ownership is www-data:www-data... how can a shell user access html subofolders?

Thanks in advance

realtebo
  • 399

1 Answers1

4

Ownership should be youruser:www-data
And youruser should be in www-data group

Permissions for folders 750, for files 640

This can be done by one command: chmod -R u=rwX,g=rX,o= /pathtofolder

If scripts used to create some files add group writable permission to needed folders(like smarty template cache)

LeonidMew
  • 2,802