Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 7285  / 1 Year ago, sun, march 5, 2023, 8:51:39

Before I say anything, I know how permission for groups and users works.



My setup is:



a. my user is monkey and is in the group www-data



groups monkey



monkey : monkey adm cdrom sudo dip www-data plugdev lpadmin sambashare



b. the root folder of apache is /home/monkey/var/www and has the permissions 0775 with owner www-data and group www-data



ls -la /home/monkey/var/www



total 8
drwxrwxr-x 2 www-data www-data 4096 Aug 12 10:37 .
drwxr-xr-x 3 root root 4096 Aug 12 10:37 ..



c. But I'm unable to write in /home/monkey/var/www/



monkey@ubuntu:~$ cp robots.txt var/www/robots.txt



cp: cannot create regular file âvar/www/robots.txtâ: Permission denied



The robots.txt file was created under monkey user.



What am I missing?


More From » 13.04

 Answers
2

your parent folder permissions (var set to 755 and owner of root) limits your child folder. you need to change your permissions to var or change the owner to www-data:www-data and perms to 775



EDIT



after some digging, the user needs to switch group with newgrp <group-name> before doing any operation. to return to the default group on that shell, type exit or Ctrl+D


[#23684] Tuesday, March 7, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
initiallartebeest

Total Points: 24
Total Questions: 118
Total Answers: 105

Location: Venezuela
Member since Thu, Jul 15, 2021
3 Years ago
;