0

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?

fishcracker
  • 191
  • 1
  • 2
  • 6
  • 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 04:19

1 Answers1

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

Toqeer
  • 1,241
  • 3
  • 14
  • 20