Script to fix users home permissions?
Hello,
I don't have a permissions issue currently, but I was just wondering whether there is a script provided by cPanel that fixes up a users home directory in case it gets messed up for some reason?
As I understand, the primary domain and add-on domains wont work if the group isn't set to "nobody" (using Litespeed). And also things like "etc" in a users home directory needs to have the group set to "mail".
Is there a script that goes through and fixes up all owner/group permissions of all the various files and folders in a users home directory?
Thanks!
-
Hi, You can use this commands: cd /home/cpaneluser ls -all | grep public_html chown -R cpaneluser.cpaneluser public_html 0 -
Hello, The main issue is knowing which PHP handler is being used and adjusting the permissions and ownership accordingly. cPanel does not provide any scripts that automatically fixes this unfortunately. There are a few places online which have permission/ownership scripts that usually work good when using the suPHP handler. If using DSO or CGI, that is where issues may occur if using one of the scripts incorrectly. 0 -
Hi, You can use this commands: cd /home/cpaneluser ls -all | grep public_html chown -R cpaneluser.cpaneluser public_html
Unfortunately this wouldn't work for all situations I'm afraid, especially if you are using lsapi with Litespeed as public_html and addon document roots need to have 'nobody' as the group. I was more looking at an script to fix everything within a users home directory, not just public_html.Hello, The main issue is knowing which PHP handler is being used and adjusting the permissions and ownership accordingly. cPanel does not provide any scripts that automatically fixes this unfortunately. There are a few places online which have permission/ownership scripts that usually work good when using the suPHP handler. If using DSO or CGI, that is where issues may occur if using one of the scripts incorrectly.
No worries at all. It would be amazing if cPanel developed a script that would fix permissions with auto handler recognition :) I'll look around, but I might end up trying to write my own bash script :)0 -
This is a simple bash script I wrote to fix the permissions and ownership of files within a cpanel account. To use, simply copy the script into your server, chmod 755, and pass the usernames as arguments: ./fixperms user1 user2
You can see the script here, let me know if it helps.0 -
I found this script: Simple Bash Script to Fix Account Permissions - The cPanel Admin Is this script acceptable? 0 -
The cPanel Admin is a great resource, but since that script is ten years old, it might be a good idea to test this on a test machine before trying it on a production server. 0 -
I found this script: Simple Bash Script to Fix Account Permissions - The cPanel Admin Is this script acceptable?
Thanks, worked for me : )0 -
I'm glad to hear that worked well! 0
Please sign in to leave a comment.
Comments
9 comments