Plesk and the naughty Apache user

I use Plesk for one of my servers and have had this problem for a while now were certain files and directories could not be removed via the Plesk File Manager or FTP, permission denied. These files were created by Joomla when I installed a module through one of it’s admin pages. The problem with this is that it creates the files with the Apache user as the owner. This means Plesk can’t delete them. Turns out this was due to me being a dumn user. Inside Plesk go to Domains->Name of your domain->Web Hosting Settings. Under Services where I have PHP Support ticked I also have it set to run as an Apache Module. The simple fix is to change this to run as a CGI Application. It’s a trade-off between performance and ease of use. Now when things are created via a CMS admin page they will be done so with the default Plesk user, the tradeoff is that it’s a wee bit more sucky when it comes to performance. For now I’m not concerned about that, convenience wins.

That sorts it out for future use but it doesn’t help if you’ve already broken things. To sort the permissions out on files that are already set to Apache you will need to connect via SSH. I use Putty to do this. You have to get the connection settings from your service provider. Once in you have to navigate to the domain directory that the naughty files are in.

Then to change the owner you do: chown username directory. Say my user name was ted and the directory with the crapped out files in is called www I’d do: chown ted www.

You can change the group with: chgrp groupname www e.g. if the group name was ducks then you would do: chgrp ducks www.

You can make both of those recursive if you really messed things up with: chown -R ted www and chgrp -R ducks www.

To change the permissions you can do: chmod -R 755 www which means the owner can write/modify/delete but other users can just view stuff.

Comments: 4

Leave a reply

Your email address will not be published. Required fields are marked *

  • Jacko
    Jacko

    It’s a good point. This is a common problem.

  • Anonymous
    Anonymous

    Here’s one that just got me banging my head on the desk for about 3 hours. Following the advice of my server host I just created a new domain with the PHP Support option set to CGI Application. After the domain is all configured and the files are uploaded no PHP files would run. Looking at the log I was getting loads of “Premature end of script headers php-cgi” errors. Google failed me. People were calling me up asking why their site wasn’t active yet. Stress, stress, stress!

    I tried loads of things, even going down to removing the domain and starting from scratch a few times. Seems the trick is to create the domain with PHP Support set to Apache, then after the domain creation is finished, modify the domain and change the dropdown to CGI Application.

  • Callum Rexter
    Callum Rexter

    Can I just say thanks for this. I was having issues with a new Joomla install on a hosting that ran on Plesk with this setting. I had a heck of a time with file permissions etc but this one was driving me to the edge.

    So thanks… seriously – it is much appreciated.

  • Jack
    Jack

    Thanks for this great post. I spent hours of frustration trying to find the answer on the plesk forums but was unable to. I suspect your post may answer a lot of common problems relating to (please excuse the keywords) unable to change CHMOD permissions, FTP error 550, FTP permission denied whilst logged in as admin, and Joomla file permissions and Joomla FTP problems.

    Thanks again. I resolved it by asking my web host company to fix the group/user permission as I do not have SSH/Terminal knowledge.

    Note to new users of Plesk and VPS users: make sure you follow the above advice BEFORE you install Joomla “Inside Plesk go to Domains->Name of your domain->Web Hosting Settings. Under Services where I have PHP Support ticked I also have it set to run as an Apache Module. The simple fix is to change this to run as a CGI Application.”

All life is sacred, stating anything to the contrary is paramount to a fanatical point of view similar to the terrorists and immigrants you denounce

— Kraskos, SWTOR Player