Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Domain permissions

Status
Not open for further replies.

louse101

IS-IT--Management
Nov 12, 2006
1
GB
This problem is on a new Linux dedicated server.

After trying for days to work out why image uploads in Wordpress only work when the folder is CHMODed to 777, I think I've worked out that my domain doesn't have the right permissions to write to itself. Bear with me...

Uploading will only work when I CHMOD the uploads folder to 777. It won't work on 755, meaning that the domain isn't recognising itself as being the owner and therefor able to write to the folder.

I'm sure all I need to do is set permissions so Wordpress can write to its own directories.

How can I do this?
 
This is more a function of the web server rather than your domain. Apache or whatever webserver you are running runs under a particular user. If you are running apache, then is is running under the user apache and group apache. Your domain name never comes into play. All programs and scripts that run on a unix or linux system need to have permissions which would allow them to read, write or execute anything in a given directory. Most scripts need a file or directory that they can write to. This is why it needs to be set to at least a minimum of 666. How we come to a number is pretty simple. Let's say we have three type of users, a specific user, a group and everybody else. We call them user, group and other in that order. Now the permissions are read, write and execute, also in that order. Read has a value of 4, write has a value of 2 and execute has a value of 1. So if I want the user to be able to read and write to a file and group and other to be able to read only, the user would get a value of 6 (4+2) and group and other would both get 4. Hence the permissions would be set to 644 (the norm for an html or php script). Script that run on the server side usually need the execute bit set. So if you want the user to be able to read, write and execute and everybody els to be able to read and execute the permissions would be 755. The reason for 777 is because apache is not the owner (user) of the file or directory so it needs permission to be set for everyone to read, write and sometimes execute for others. This is usually not a good idea for a directory to be set to 777 where it is accessable by anybody who browses to that directory. This is why these directories are usuall set outside the webspace. I know I rambled on for a bit but I hope this makes things a little more clear.

 
I would chgrp apache the directory in question and chmod 775 or chmod 770 it rather than making it world-writeable.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top