Introduction
All files in a user's public_html should be owned by the user. If files are owned by something other than the user, such as root, this can introduce issues where files are not properly accessible by the user.
Please note: Recursive tasks can be risky to perform if done improperly. This task should be performed by a System Administrator to minimize risk to the files in your account or on your server.
Procedure
Using absolute paths to explicitly define the files you are correcting will minimize the risk of running the following commands. You will need to refer to the user's document root folder, which is public_html. By default, these are in /home, but if your home folders are stored elsewhere, you will need to modify the commands below:
- Replace the variable $username with the actual username that you wish to correct:
chown --preserve-root -R $username.$username /home/$username/public_html/{*,.[!.]*}
- The user and group ownership for all files should now be set to match the user. The username for the public_html folder itself should be set to "nobody" if File Protect is enabled. Otherwise, it will be set to the user as well. If File Protect is enabled, you can verify by looking for this touch file:
[root@server ~]# ls -al /var/cpanel/fileprotect
-rw-r--r-- 1 root root 0 Feb 10 04:31 /var/cpanel/fileprotect
Comments
0 comments
Article is closed for comments.