Wednesday, November 25, 2015

permissions - Can't create files with `ubuntu` user under `/var/www`

I've added ubuntu user to the www-data group and set the folder permissions as follows:



sudo gpasswd -a "$USER" www-data
find /var/www -type f -exec chmod 0640 {} \;
sudo find /var/www -type d -exec chmod 2750 {} \;


I can verify that ubuntu has been added to the group (running groups shows ubuntu www-data). I can access and read any files and directories in the /var/www directory as ubuntu.




I want to grant write permissions to ubuntu user in certain directories. Running sudo chmod -R g+w /var/www/public/uploads/ gives ubuntu access to write into this folder.



The problem is that when www-data creates new directories in /var/www/public/uploads/, ubuntu does not have permission to write in these newly created directories.



That is, when www-data creates /var/www/public/uploads/some-new-folder/, ubuntu cannot touch files in some-new-folder.



How can I change the permissions so that any files and directories created by www-data in specific paths will be writable by ubuntu as well?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...