Articles in this section

A website hosted in Plesk shows 403 Forbidden error due to invalid permissions: Permission denied

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • When opening a website page in a web browser, it fails to load with a 403 Forbidden error.
  • One of the following error messages is logged in domain's log at Plesk > Domains > example.com > Logs:

    CONFIG_TEXT: AH01071: Got error 'PHP message: PHP Warning: require(/var/www/vhosts/example.com/httpdocs/wp-includes/load.php): failed to open stream: Permission denied in /var/www/vhosts/example.com/httpdocs/wp-settings.php on line 19
    PHP message: PHP Fatal error: require(): Failed opening required '/var/www/vhosts/example.com/httpdocs/wp-includes/load.php' (include_path='.:/opt/plesk/php/7.1/share/pear') in /var/www/vhosts/example.com/httpdocs/wp-settings.php on line 19'

    CONFIG_TEXT: [crit] [client 203.0.113.2] (13)Permission denied: /var/www/vhosts/example.com/httpdocs/css/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: http://www.example.com/index.html

  • File Manager of a domain fails to open with the error message:

    PLESK_ERROR: Unable to find the directory /var/www/vhosts/example.com: filemng failed: move_to_cgroup(): pam_open_session() failed 6: Permission denied Unable to limit resources for process 6665 for user john_doe filemng: opendir failed: Permission denied System error 13: Permission denied

Cause

Incorrect permissions or ownership for website files and directories.

Resolution

Set default permissions for files (644) and directories (755) inside domain's document root:

  1. Connect to your Plesk server via SSH.
  2. Obtain the document root directory and the system username of a domain:

    Note: Replace example.com with a domain name in question.

    # plesk db "select name, login, www_root from domains join hosting on domains.id=hosting.dom_id join sys_users on hosting.sys_user_id=sys_users.id where name='example.com'"

    Sample output:

    CONFIG_TEXT: +-------------+----------+--------------------------------------+
    | name        | login    | www_root                             |
    +-------------+----------+--------------------------------------+
    | example.com | john_doe | /var/www/vhosts/example.com/httpdocs |
    +-------------+----------+--------------------------------------+

  3. Using the information from step 2, replace the values (in bold) in the commands below and run them:
    • Set default permissions for directories:

      # find /var/www/vhosts/example.com/httpdocs/ -type d -exec chmod 755 {} \;

    • Set default permissions for files:

      # find /var/www/vhosts/example.com/httpdocs/ -type f -exec chmod 644 {} \;

    • Repair ownership with plesk repair fs utility:

      # plesk repair fs -y example.com

      or manually with the commands:

      # find /var/www/vhosts/example.com/httpdocs/ -type f -exec chown john_doe:psacln {} \;
      # find /var/www/vhosts/example.com/httpdocs/ -type d -exec chown john_doe:psacln {} \;

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.