Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Odd problem with linux user permissions (Wordpress)

Options
  • 09-09-2011 2:56pm
    #1
    Registered Users Posts: 1,657 ✭✭✭


    Hi folks

    Edit: It seems to be fine for the moment... but read on if you're interested anyway.

    This is an odd one...
    I am trying to set up a Wordpress site (host is myhost.ie)
    Now Wordpress uploads all its image by default into a dir called uploads/[yyyy]/[mm] (yyyy = year, mm = 2-digit month)
    So if you go into a new month, and upload a new image, it creates a new directory and puts your image into it.
    That's all fine.

    But I'm having a problem - and that is that the user uploading the files (whatever the user the server is running under) does not seem to have permission to write files to its own directory!

    In other words. A new month dawns and I upload the image to a new post in WP. It creates a directory called uploads/2011/09, but then returns an error when uploading the image.

    So I check in FTP and even though the permissions are 0777, the owner/group is 48/48. I delete the dir and recreate it myself in FTP, give it 777 perms and the owner/group is 10060/2524.

    Now I try again to upload my file in wordpress and it works fine! I check again in FTP and the files that were uploaded have the owner/group 48/48!

    I'm not too up on how web servers work but I'm assuming 48 is the user that runs the web server and 10060 is the FTP user. Now anyone should be able to write to the dir (it having 777 perms) but why is it the web user can't write to it if it owns it but it can if the FTP user owns it?

    Edit:
    I just tried it again (to try and remember what the actual error message was) and wouldn't you know it, it's fine now. I'll leave the message here in case someone does happen to know what's going on and I'll bump it if it happens again.


Comments

  • Registered Users Posts: 845 ✭✭✭tylercollins


    By any chance is the server running on Plesk?


  • Registered Users Posts: 1,657 ✭✭✭komodosp


    Yes it is! I've submitted a ticket with them the other day as it happened again but no response yet...


  • Registered Users Posts: 845 ✭✭✭tylercollins


    I searched for nearly 2 months to get a resolution and finally about 3 weeks go I got a fix to change the permissions and owners group to what is needed.

    I had problems with updating the core files, uploading files, installing some plugins, some plugins not working etc etc etc

    When I get into work tomorrow I'll post up the snippet.

    Do you have access to a command line on the server?


  • Registered Users Posts: 1,657 ✭✭✭komodosp


    That'd be great, however I don't have command line access. Is it possible to do it anyway?

    Can you post it up anyway if you have it handy?

    Thanks!


  • Registered Users Posts: 845 ✭✭✭tylercollins


    Hey, apologies I forgot to get the snippet today from work. I will do it once I get in tomorrow.

    I'm not sure to be honest, I manage a VPS in work and have access to root.


  • Advertisement
  • Registered Users Posts: 845 ✭✭✭tylercollins


    cd /var/www/vhosts/yourwebsite.co.uk/httpdocs && chown -R username:psacln * && find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;
    


  • Registered Users Posts: 6,501 ✭✭✭daymobrew


    komodosp wrote: »
    That'd be great, however I don't have command line access. Is it possible to do it anyway?
    You could put the code into a script and set up a cron job to execute it once, assuming that your hosting control panel has cron jobs (scheduled running of scripts).


  • Registered Users Posts: 1,657 ✭✭✭komodosp


    Hey thanks for that...

    Haven't tried it yet (I will see if I can set up cron jobs) - however from looking at it it seems to change all the owners psacln and change all the permissions. This will presumably affect all directories in my site.

    But I want to make sure future directories don't suffer from this problem... Will this make sure future directories are set to the correct owner?


  • Registered Users Posts: 1,657 ✭✭✭komodosp


    I've tried the snippet and I'm getting an error (chown: `username:psacln': invalid user) also tried with the FTP username with the same error.

    Aso came across a page suggesting a change to FastCGI which I got the admin to do, but that didn't work either... But at least I'm in touch with the admin now...


  • Registered Users Posts: 1,657 ✭✭✭komodosp


    I think what happened is they did the FastCGI thing but didn't do it properly... It's sorted now... (They fixed whatever they did wrong)

    Thanks for your help, guys.... I don't know how to change the status to "Solved" but it is...


  • Advertisement
Advertisement