View Full Version : chmod woes.
iGoD ReLeNtLeS
05-03-11, 23:50
I've recently installed a wordpress blog onto my server, installed all fine etc. chmod'ed the content directory to 777 so the php scripts have sufficient access to create files etc, however when i upload a new image into the gallery's directory or create a file through the php scripts i must then go and chmod each new file otherwise its 403 fobbiden.
Is there anyway i can make the chmod apply to all new files created in the directory without the need to keep chmoding every new file?
I'd take a look at the owner of the directory and the user the wordpress process or the webserver process runs as.
If the 2 are different then it may be the user account of the process doesn't have full access to the dir. Alternatively you could try setting the umask in the process owner's profile.
Failing all that you could knock a script up to chmod any or all files :D
Just my 2p following on... 777 is usally a really bad idea especially on a public facing server ;) Great for diagnosing / fault finding, but once you've sorted the problem please change the permissions to 770 or similar ;)
iGoD ReLeNtLeS
06-03-11, 00:28
I'd take a look at the owner of the directory and the user the wordpress process or the webserver process runs as.
If the 2 are different then it may be the user account of the process doesn't have full access to the dir. Alternatively you could try setting the umask in the process owner's profile.
Failing all that you could knock a script up to chmod any or all files :D
Just my 2p following on... 777 is usally a really bad idea especially on a public facing server ;) Great for diagnosing / fault finding, but once you've sorted the problem please change the permissions to 770 or similar ;)
ah yes i forgot to mention about the chown of the dir. I have grouped both the www-data (the user that is running the apache proccess) and my user into the same group and chowned the group for the whole of the /var/www/ dir.
I have chmod'ed the content directory to 775 as that is the lowest permission set it will allow, otherwise it returns a blank page as the php scripts cannot be executed. I will try chowning the /var/www/ dir to the web process, however i have a feeling that will stop me being able to ftp stuff onto the server itself.
EDIT: Yeh chowning to the www-data doesnt allow my ftp to edit or put anyfiles onto the server. Still dont really understand these octal permission sets.
If I understand right, I think you need to chgrp the /var/www/ dir to the group that your account and the www-data account are in. That should allow the process to write to it and you to ftp as well, regardless of which user owns it via chown - assuming the permissions are still 775.
Hope that makes sense :)
Lorem-Ipsum
06-03-11, 01:30
Still dont really understand these octal permission sets.
Read the man page!!!
A numeric mode is from one to four octal digits (0-7), derived by adding up the bits with values 4, 2, and 1. Omitted digits are assumed to be leading zeros. The first digit selects the set user ID (4) and set group ID (2) and restricted deletion or sticky (1) attributes. The second digit selects permissions for the user who owns the file: read (4), write (2), and execute (1); the third selects permissions for other users in the file's group, with the same values; and the fourth for other users not in the file's group, with the same values.
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.