The MU forums have moved to WordPress.org

Wordpress MU assigns incorrect rights to new folders? (18 posts)

  1. MartinNr5
    Member
    Posted 15 years ago #

    Hi.

    I've done a search for this but I must be wording it wrong as I have a hard time believing that I'm the only one with this problem.

    Anyhow, whenever a user uploads new files (photos, etc) Wordpress MU creates a new folder for it in the blogs.dir folder but it's always the wrong rights set (httpd/755) which in turn leads to subfolders not being created (no access), ergo - no files uploaded.

    I've been in contact with my host and they say that this isn't anything they control and told me to look at Wordpress MU to see if the problem might lie there.

    So, any advice for this?

    TIA!

  2. SteveAtty
    Member
    Posted 15 years ago #

    It is nothing to do with WPMU.

    WPMU will use the umasks that PHP uses.

    Those, if not overridden in the application are inherited from the permissions of the user used to run the apache web server.

    For example on Ubuntu the user that runs the apache services is www-data which has a umask of 0022

  3. MartinNr5
    Member
    Posted 15 years ago #

    Grrr, something along these lines is what I was thinking when I contacted the hosts support but I guess they have no clue as usual.

    Is it possible to set these rights on a per user basis on a "shared" host? If so, what should I tell the support people to do?

    If not, can I edit Wordpress MU in any way to set the correct access rights?

    Thanks Steve for your quick reply, much appreciated!

  4. SteveAtty
    Member
    Posted 15 years ago #

    There is a umask function in php but I think its a transitory function in that once the script finishes its discarded.

    There are a few uses of umask in the WPMU code but the only one that would seem to be relevant which is in class-wp-filesystem-direct.php simply gets the current umask.

    There seems to be nowhere in the code that overides the inherited permissions.

    So when the files are created what is the owner, group etc?

  5. pumpkinpatch
    Member
    Posted 15 years ago #

    Use something like Filezilla to view user/group settings. I suspect this might have changed to 99 99, when actually, you are supposed to be the owner instead of Apache.
    Any amount of permission changing , including 777, will not help.
    If you don't have root access, only Root can change it. I guess your host will have to do it. And they should remember to do it recursively, not just one folder. It is a simple Unix command...

  6. MartinNr5
    Member
    Posted 15 years ago #

    @Steve: The user is httpd with 777 for the first folder, in the current case "8" in "blogs.dir", and then httpd with 755 for the next folder, "files". After this the user gets an error stating that they can't upload any files.

    @pumpkin: I can change the owner of the files and folders to my account which does indeed help but the problem occurs everytime a new user wants to upload files to his blog which means that it's completely impractial.

    Maybe I should just fork out for a dedicated host...

  7. timmy77
    Member
    Posted 15 years ago #

    I also have noticed that in two wpmu installations certain files/folders are assigned to the owner Apache, such as blogs.dir folder and .htaccess file.
    I wonder why that happens!
    I changed the .htaccess ownership to admin, but when I did that for blogs.dir , useres coulden't upload files, so I reversed it to Apache and the chmod is 755.
    When I want to edit something in that folder I access it from the root ..IF I had to.

  8. VentureMaker
    Member
    Posted 15 years ago #

    I also have noticed that in two wpmu installations certain files/folders are assigned to the owner Apache, such as blogs.dir folder and .htaccess file.
    I wonder why that happens!

    Because these files/folders are created during installation by PHP script. Looks like you run PHP as Apache module, not in CGI mode.

  9. timmy77
    Member
    Posted 15 years ago #

    "Looks like you run PHP as Apache module, not in CGI mode."

    And would that make a differance except for this issue ?

  10. VentureMaker
    Member
    Posted 15 years ago #

    Yes, it makes a GREAT difference :)
    When PHP runs in CGI mode all php scripts are executed under users they belong to.
    If PHP runs as Apache module - all scripts are executed under httpd user.
    For example, you may easily tell what user sends SPAM via his/her PHP scripts. If you have PHP as Apache module - you'll see httpd in all cases, not allowing you to see what users' scripts are doing.
    Yes, PHP as CGI is more resource consuming. But it's really worth it.
    You may also want to check this: http://www.fastcgi.com/devkit/doc/fastcgi-whitepaper/fastcgi.htm

    Well, all our servers (and clients servers that we manage) have PHP running in CGI mode.

  11. SteveAtty
    Member
    Posted 15 years ago #

    But if he is running it as an apache module the the user accessing the folders that WPMU creates is the user that created them. So the group and other privs on the folders should not matter.

  12. VentureMaker
    Member
    Posted 15 years ago #

    Steve, you're right. Almost :)

    Anyhow, whenever a user uploads new files (photos, etc) Wordpress MU creates a new folder for it in the blogs.dir folder but it's always the wrong rights set (httpd/755) which in turn leads to subfolders not being created (no access), ergo - no files uploaded.

    New folders are created by php script and so they get httpd/755

    But the php script responsible for uploading files (wp-admin/upload.php or what else it is) was uploaded via FTP by user and so I guess gets user/644.
    Permission doesn't really matter, but owner does.

  13. pumpkinpatch
    Member
    Posted 15 years ago #

    I can change the owner of the files and folders to my account which does indeed help but the problem occurs everytime a new user wants to upload files...

    You mean the parent folder is yours, but all under that have Apache as owner- everytime a user is created?
    I have had parent and all child folders change owners to Apache all of a sudden, even after specific users have been using it for months. I had root reassign it on request, and I think it was something on the host's end that was causing this. Don't know what specifically though. Anyone know why this would happen?

  14. VentureMaker
    Member
    Posted 15 years ago #

    I have had parent and all child folders change owners to Apache all of a sudden, even after specific users have been using it for months.

    Looks like pretty straightforward and not careful 'server hardening' that is sometimes done by various companies...

  15. SteveAtty
    Member
    Posted 15 years ago #

    If PHP is running as a module then the owner will be apache for everything, that includes new folders and files that are uploaded and so there shouldn't be a problem. This is how my server runs and its totally fine.

    If PHP is running as a CGI and the user uploaded all the scripts then they will run as them so again there shouldn't be a problem.

    If they are seeing changes in folders owners then yes it looks like someone is playing round with something somewhere and so its going to be hard to resolve the problem until everything has stabilised.

  16. timmy77
    Member
    Posted 15 years ago #

    This is interesting.

    "all our servers (and clients servers that we manage) have.."

    @VentureMaker
    If I may ask.. "our" refers to whom?
    .

  17. MartinNr5
    Member
    Posted 15 years ago #

    Thanks for all the help, very much appreciated.

    @VentureMaker: So if I set the owner of the script responsible for uploads to "httpd" it should fix things?

    I know I have to fiddle a bit when updating MU if I do that but that's a price I'm willing to pay.

  18. VentureMaker
    Member
    Posted 15 years ago #

    timmy, 'our' refers to us :) we run a web hosting business.

    Martin, try to chown everything you've uploaded to httpd and then run installation.

About this Topic

  • Started 15 years ago by MartinNr5
  • Latest reply from VentureMaker