Tuesday, 12 February 2008

Joomla installation on Plesk server, getting permissions right

Installing Joomla on a Plesk server has it's problems with permissions. I think this gives a nice solution. The original inspiration comes from the rackerhacker article.



The steps are:



  1. Add the ‘apache’ user to the ‘psacln’ group by editing /etc/group

    i.e. psacln:x:_hidden(dont actually change this field!)_:apache


  2. Change the current directory permissions with:

    cd /home/httpd/vhosts/[domain.com]
    chown -R [username]:psacln httpdocs
    chmod -R g+w httpdocs
    find httpdocs -type d -exec chmod g+s {} \;

    This set the setuid bit on each of the directories


  3. Reload the apache settings with /etc/init.d/httpd reload


  4. If you are using proftp to upload files or the new joomla 1.5 ftp layer then change the umask for proftpd by editing ‘/etc/proftpd.conf’ to read Umask 002


  5. Otherwise change the umask that php uses. The easiest, but I guess least elegant way is to add the line <?php umask (0002); ?> to the top of the administrator template index.php file. In Joomla 1.5 this is "administrator/templates/khepri/index.php"

7 comments:

LeHHeL said...

I suggest try to install mod_suphp and configure per domain. In this way the files uploaed via Joomla will get ftpuser:psacln rights and you can work with them. Also not need to be anymore 777 the folders.
See more on
http://www.web-hosting-control-panel-addons.com/description.php/HOW-TO_setup_a_PLESK_Dedicated_Server/6/

Here you can see how to setup mod_suphp to work well on a PLESK server for Joomla, Drupal, or any other similar software. Hope this help.

Neville Dastur said...

Thanks, I'll have a look at that.

But note that the above doesn't set the directories as 777. But I take the point that they are writtable to any apache process. If I am not mistaken this is not a problem as plesk sets a base dir for each virtual host and so a user could not read/write outside of their directory AFAIK.

Axel Werner said...

hi. thanks for sharing! but .. it seems this wont work for me. i run a home made ubuntu linux server (no plesk or foreighn hostet crap). my apache runs as www-data, my proftpd runs with umask of 002 002 pretty much out of the box (and does a good umask when used with a common ftp client), and joomla 1.5.7 . i set the SETGUID (Sticky Bit) on the joomla-root (and all subdirs) too, and if creating subdirs by hand it will work quite fine. but whenever i try to install a joomla-plugin with the joomla-web-installer the new created subdirs "look like umasked by 022" - STILL!! i dont get it WHY they are still umasked by 022 !! WHERE ?? i even set the apache to umask 002 - any suggestions ?

Carlos said...

Many thanks to Neville for this post. I have used it on numerous occasions and it has worked a treat to ensure Joomla works properly.

However, more recently on a new server running Plesk 9.3.0, these commands appear to break Plesk. I have had to rebuild twice.

Having said that, it could just be an unstable version of Plesk - but this does appear to trigger the break.

Neville Dastur said...

It does seem odd that some directory permission settings should "break" plesk. Actually I have never come across a situation where I have had to "re-build" Plesk. I don't run 9.3 as 8 works perfectly well and ironicly I did not want to break things! So sorry but can't test.

Carlos said...

Further to my previous comment, the commands posted by Neville had nothing to do with Plesk 9.3.0 breaking. The problem I had stemmed from a corrupt installation of Plesk. Apologies if I alarmed anybody thinking of using this. I should reiterate that I have used it many times before and it has worked perfectly - thanks again Neville.

david watson said...

Very good post , i will bookmark your blog right now
SEO Singapore