Website create event hook to change httpdocs permissions

Discussion in 'Parallels Plesk Panel 10.x for Linux Problems, Suggested Fixes, and How-To' started by davidcroda, Feb 22, 2011.

  1. davidcroda

    davidcroda New Member

    Messages:
    4
    Hello,

    I am running into the issue that the httpdocs and httpsdocs of newly created sites have their permissions set to 750. This is causing Access Denied errors when trying to visit the URL until the permissions are changed to 755.

    I searched on the internet, and this seems to be a common error. The recommended solution was to subscribe to an event to automatically change the permissions on the newly created directory.

    Unfortunately, though the documentation says it exists, I could not locate the Advanced Administrators Guide for Plesk 10.1 which supposedly lists all of the events and their variables.

    Nevertheless, I was able to setup an hook for the Website created event, which successfully receives the new domain name as parameter. Here is the code for the hook:

    #!/bin/bash
    echo "--------------" >> /tmp/event_handler.log
    /bin/date >> /tmp/event_handler.log
    /usr/bin/id >> /tmp/event_handler.log
    echo "subscription created" >> /tmp/event_handler.log
    echo "domain: ${NEW_DOMAIN_NAME}" >> /tmp/event_handler.log
    chmod 755 /var/www/vhosts/${NEW_DOMAIN_NAME}/httpdocs
    echo "--------------" >> /tmp/event_handler.log

    I have subscribed it to the Website created event, run as root, with the command:
    sh /usr/local/psa/bin/post-domain-create.sh

    The bash script is able to properly get the domain name, and adds it to the log. But the httpdocs folder is still set to 750. I have tested the script by hardcoding values for NEW_DOMAIN_NAME and executed it manually, and it properly changes the permissions.

    My guess it that I am subscribed to the wrong event. I am thinking that there is an event later on, which is resetting the permissions to 750.

    Can anyone help me figure out what is going wrong and how to fix this? It is frustrating to have to SSH to the server each time a new site is added, and keeps other less technical users from being able to create websites.
  2. davidcroda

    davidcroda New Member

    Messages:
    4
    I am not sure why my script wasn't working, but I have resolved the access denied issue, so I no longer need this work around.

    It was my own mistake, somehow the user apache had been removed from the psaserv group.

Share This Page