1

I am trying to to view the groups that belong to a directory and to enable www-data to be an admin of a directory so I am able to delete files that are within it using php unlink functionality. I have looked on the net and tried a number of things which chgrp and chmod etc but I am not getting anywhere. Could someone point me in the right direction. I believe I am just doing things in the wrong order and need some guidance. I know a little bit of linux but not a great deal and I think this is my trouble.

Context: The folder is within a NAS drive. Apache is setup to point to the NAS drive and content is served as expected. However, when it comes to deleting files from a sub folder I recieve the unlink permission denied error within php (assuming this is due to www-data not having access to delete from the folder)

1 Answer 1

0

You are very close, the chown command sets user and group ownership. In order to change the user or group owner for a directory or file see the exampled below.

ex. chown user:group /path/to/directory/or/file

If you would like to change the ownership of a directory and all the files and sub-directories you can use a command like below, but be very, very careful, it can be a dangerous command if not used prudently.

chown user:group /path/to/directory -R

1
  • HI, I navigated to the folder that contains the folder I wanted to set the permissions on and I done chown www-data:www-data dirName -R. However, it still does not work. Do I have to use the full path to it. Does it make a difference that the folder is located on a NAS drive that is mapped to the box? Nov 17, 2016 at 12:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .