Plesk

How to restore default permissions in virtual host directory on Plesk for Linux?

Question

How to restore default permissions in virtual host directory on Plesk for Linux?

Answer

Note: solution for Plesk for Windows is available in the article How to restore default permissions on a domain in Plesk for Windows?

  1. Log into Plesk.
  2. Go to Domains > example.com > File Manager.
  3. Clicknext to a directory or a file and click Change Permissions.
  4. Set the permissions, enable the option Change permissions recursively if necessary, and click Save or Save and resume to apply the changes:

Note: The recommended permissions are 755 for directories (Read, Write, and Execute for owner, Read and Execute for group and others) and 644 for files (Read and Write for owner, Read for group and others).

In the command-line interface

  1. Connect to the server using SSH.

  2. Obtain list of subscriptions along with their system user names:

    # plesk db "select name, login from domains join hosting on domains.id=hosting.dom_id join sys_users on hosting.sys_user_id=sys_users.id"

  3. Run the following commands with replacing example.com with the real subscription name and user_example with the system user of the subscription found in step 2:

    Note: substitute example.com with the real subscription name and user_example with the system user of the subscription.

    # find /var/www/vhosts/example.com/httpdocs/ -type f -exec chmod 644 {} ;
    # find /var/www/vhosts/example.com/httpdocs/ -type d -exec chmod 755 {} ;
    # find /var/www/vhosts/example.com/httpdocs/ -type f -exec chown user_example:psacln {} ;
    # find /var/www/vhosts/example.com/httpdocs/ -type d -exec chown user_example:psacln {} ;