Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
What are the best linux permissions to use for my website?

I have a script that will generate an image then upload it in a certain directory. The script works fine, however uploading it in the CentOS server, it won't work anymore. By debugging, I have found out that this is a permission denied issue. I am forced to chmod -R 777 certain_directory to make it work.

I am not convince with this, I can't set the directory ownership to www-data I'm used to when I am using Debian. Any workaround for this?

share|improve this question

marked as duplicate by Michael Hampton, Iain Nov 18 '12 at 12:40

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.

1  
www-data is a debian-ism, CentOS and other RH-type distros use a different username for their webserver, but I don't know what it is (apache?). –  DerfK Nov 18 '12 at 4:19

1 Answer 1

The user you are using to upload the image to the certain_directory should have write permission on the directory you are uploading to. Now for example the user is jon then you can change the directory permission by

chown jon:jon certain_directory.

If you do not want to change the ownership to jon user then add jon in user's group by editing the /etc/group and change the permission of the group by using the command

chmod 764 certain_directory.

Here 6 means user can read and write to certain_directory

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.