Confused about permission of group `www-data` for `/var/www/html' [duplicate]












0
















This question already has an answer here:




  • Permissions problems with /var/www/html and my own home directory for a website document root

    3 answers




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










share|improve this question















marked as duplicate by Thomas Ward Jan 11 at 16:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • Are you sure that you are a member of www-data? I can't see www-data in your output. try logging out and relogin after adding your self to www-data: sudo gpasswd -a mirko www-data

    – Ravexina
    Jan 11 at 16:20











  • You can use 775 for folders and 664 for files. chmod -R g+w /var/www/html .

    – RoVo
    Jan 11 at 16:20








  • 1





    please reference the "suggested ownership", who is telling that ?

    – RoVo
    Jan 11 at 16:33






  • 1





    @Rovo: OMG !!! The solution was is the link I just pasted !!! the ownership shuold be 'user:www-data' !!!!! I am so stupid ...

    – realtebo
    Jan 11 at 16:35






  • 1





    And then you can give g+w for files that www-data needs write access. You can write the answer best by yourself I guess ;-)

    – RoVo
    Jan 11 at 16:37


















0
















This question already has an answer here:




  • Permissions problems with /var/www/html and my own home directory for a website document root

    3 answers




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










share|improve this question















marked as duplicate by Thomas Ward Jan 11 at 16:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • Are you sure that you are a member of www-data? I can't see www-data in your output. try logging out and relogin after adding your self to www-data: sudo gpasswd -a mirko www-data

    – Ravexina
    Jan 11 at 16:20











  • You can use 775 for folders and 664 for files. chmod -R g+w /var/www/html .

    – RoVo
    Jan 11 at 16:20








  • 1





    please reference the "suggested ownership", who is telling that ?

    – RoVo
    Jan 11 at 16:33






  • 1





    @Rovo: OMG !!! The solution was is the link I just pasted !!! the ownership shuold be 'user:www-data' !!!!! I am so stupid ...

    – realtebo
    Jan 11 at 16:35






  • 1





    And then you can give g+w for files that www-data needs write access. You can write the answer best by yourself I guess ;-)

    – RoVo
    Jan 11 at 16:37
















0












0








0









This question already has an answer here:




  • Permissions problems with /var/www/html and my own home directory for a website document root

    3 answers




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










share|improve this question

















This question already has an answer here:




  • Permissions problems with /var/www/html and my own home directory for a website document root

    3 answers




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





This question already has an answer here:




  • Permissions problems with /var/www/html and my own home directory for a website document root

    3 answers








server permissions php nginx






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 11 at 16:33







realtebo

















asked Jan 11 at 15:55









realteborealtebo

205214




205214




marked as duplicate by Thomas Ward Jan 11 at 16:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Thomas Ward Jan 11 at 16:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Are you sure that you are a member of www-data? I can't see www-data in your output. try logging out and relogin after adding your self to www-data: sudo gpasswd -a mirko www-data

    – Ravexina
    Jan 11 at 16:20











  • You can use 775 for folders and 664 for files. chmod -R g+w /var/www/html .

    – RoVo
    Jan 11 at 16:20








  • 1





    please reference the "suggested ownership", who is telling that ?

    – RoVo
    Jan 11 at 16:33






  • 1





    @Rovo: OMG !!! The solution was is the link I just pasted !!! the ownership shuold be 'user:www-data' !!!!! I am so stupid ...

    – realtebo
    Jan 11 at 16:35






  • 1





    And then you can give g+w for files that www-data needs write access. You can write the answer best by yourself I guess ;-)

    – RoVo
    Jan 11 at 16:37





















  • Are you sure that you are a member of www-data? I can't see www-data in your output. try logging out and relogin after adding your self to www-data: sudo gpasswd -a mirko www-data

    – Ravexina
    Jan 11 at 16:20











  • You can use 775 for folders and 664 for files. chmod -R g+w /var/www/html .

    – RoVo
    Jan 11 at 16:20








  • 1





    please reference the "suggested ownership", who is telling that ?

    – RoVo
    Jan 11 at 16:33






  • 1





    @Rovo: OMG !!! The solution was is the link I just pasted !!! the ownership shuold be 'user:www-data' !!!!! I am so stupid ...

    – realtebo
    Jan 11 at 16:35






  • 1





    And then you can give g+w for files that www-data needs write access. You can write the answer best by yourself I guess ;-)

    – RoVo
    Jan 11 at 16:37



















Are you sure that you are a member of www-data? I can't see www-data in your output. try logging out and relogin after adding your self to www-data: sudo gpasswd -a mirko www-data

– Ravexina
Jan 11 at 16:20





Are you sure that you are a member of www-data? I can't see www-data in your output. try logging out and relogin after adding your self to www-data: sudo gpasswd -a mirko www-data

– Ravexina
Jan 11 at 16:20













You can use 775 for folders and 664 for files. chmod -R g+w /var/www/html .

– RoVo
Jan 11 at 16:20







You can use 775 for folders and 664 for files. chmod -R g+w /var/www/html .

– RoVo
Jan 11 at 16:20






1




1





please reference the "suggested ownership", who is telling that ?

– RoVo
Jan 11 at 16:33





please reference the "suggested ownership", who is telling that ?

– RoVo
Jan 11 at 16:33




1




1





@Rovo: OMG !!! The solution was is the link I just pasted !!! the ownership shuold be 'user:www-data' !!!!! I am so stupid ...

– realtebo
Jan 11 at 16:35





@Rovo: OMG !!! The solution was is the link I just pasted !!! the ownership shuold be 'user:www-data' !!!!! I am so stupid ...

– realtebo
Jan 11 at 16:35




1




1





And then you can give g+w for files that www-data needs write access. You can write the answer best by yourself I guess ;-)

– RoVo
Jan 11 at 16:37







And then you can give g+w for files that www-data needs write access. You can write the answer best by yourself I guess ;-)

– RoVo
Jan 11 at 16:37












1 Answer
1






active

oldest

votes


















2














Ownership should be you:www-data



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)






share|improve this answer
























  • There is a problem: when I create new files, the setgid bit is ignored, so new files are owned by "mirko:mirko" instead of "mirko:www-data". Why?

    – realtebo
    Jan 12 at 12:41






  • 1





    are folder group also www-data? I don't know, with gid bit it should be fine, try to create file in other program to test

    – LeonidMew
    Jan 12 at 12:51


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Ownership should be you:www-data



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)






share|improve this answer
























  • There is a problem: when I create new files, the setgid bit is ignored, so new files are owned by "mirko:mirko" instead of "mirko:www-data". Why?

    – realtebo
    Jan 12 at 12:41






  • 1





    are folder group also www-data? I don't know, with gid bit it should be fine, try to create file in other program to test

    – LeonidMew
    Jan 12 at 12:51
















2














Ownership should be you:www-data



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)






share|improve this answer
























  • There is a problem: when I create new files, the setgid bit is ignored, so new files are owned by "mirko:mirko" instead of "mirko:www-data". Why?

    – realtebo
    Jan 12 at 12:41






  • 1





    are folder group also www-data? I don't know, with gid bit it should be fine, try to create file in other program to test

    – LeonidMew
    Jan 12 at 12:51














2












2








2







Ownership should be you:www-data



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)






share|improve this answer













Ownership should be you:www-data



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)







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 11 at 16:46









LeonidMewLeonidMew

524418




524418













  • There is a problem: when I create new files, the setgid bit is ignored, so new files are owned by "mirko:mirko" instead of "mirko:www-data". Why?

    – realtebo
    Jan 12 at 12:41






  • 1





    are folder group also www-data? I don't know, with gid bit it should be fine, try to create file in other program to test

    – LeonidMew
    Jan 12 at 12:51



















  • There is a problem: when I create new files, the setgid bit is ignored, so new files are owned by "mirko:mirko" instead of "mirko:www-data". Why?

    – realtebo
    Jan 12 at 12:41






  • 1





    are folder group also www-data? I don't know, with gid bit it should be fine, try to create file in other program to test

    – LeonidMew
    Jan 12 at 12:51

















There is a problem: when I create new files, the setgid bit is ignored, so new files are owned by "mirko:mirko" instead of "mirko:www-data". Why?

– realtebo
Jan 12 at 12:41





There is a problem: when I create new files, the setgid bit is ignored, so new files are owned by "mirko:mirko" instead of "mirko:www-data". Why?

– realtebo
Jan 12 at 12:41




1




1





are folder group also www-data? I don't know, with gid bit it should be fine, try to create file in other program to test

– LeonidMew
Jan 12 at 12:51





are folder group also www-data? I don't know, with gid bit it should be fine, try to create file in other program to test

– LeonidMew
Jan 12 at 12:51



Popular posts from this blog

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

張江高科駅