Monday, February 19, 2018

linux - permissions on upload folder not working



I have a php script which uploads images to a folder.



I have these permissions on the upload folder:



  drwxrwxr--  4 user user   4096 2010-06-02 16:20 temp_images


Shouldn't these permissions be enough for files to be uploaded to the folder?




But this doesn't work.



It only works when I set the permissions to 777.



"user" is added to the www-data group, still no luck.



Any ideas why?


Answer



Your folder is owned by the user and group user. If apache is running as a different account, perhaps www-data then apache will not be able to write there. Adding the user account to the www-data group would mean that user is permitted to write in folders that the www-data group owns and is set for rw. If you want apache to write to the folder the group user owns the apache service account must be a member of the user group.



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...