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?
Since Plesk Obsidian 18.0.35, it is possible to change files and directories permissions in the Plesk interface:
- Log into Plesk.
- Go to Domains > example.com > File Manager.
- Click
next to a directory or a file and click Change Permissions.
- 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
-
Connect to the server using SSH.
-
Run the following commands:
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 {} ;