meramsey / cyberpanel-fixperms

13 stars 8 forks source link

Bug in script #2

Closed vpsinghbaghel closed 4 years ago

vpsinghbaghel commented 4 years ago

Hi, Here is the explanation of my subject. When we run this script for all accounts in cyberpanel using -all option, along with the public_html contents, it fixes permissions for vmail mailboxes and files also. This is not the issue. The problem is when its fixing permissions for all accounts, it executes changing ownership and permissions setups for the whole vmail directory and its subcontents which includes all the accounts within this directory. This process repeats with every single account. Here fixing permissions for vmail is required only once. because all account's mailboxes have same user and group ownership. This user:group ownership resets again and again with every single account. It's repeating unnecessary process and takes huge amount of time in fixing permissions for vmail directories and files again and again. This can be removed from the loop so that it happens only once, even when script executed for all the accounts. Thank You.

meramsey commented 4 years ago

@vpsinghbaghel Please test the new version and let me know if you notice any issues. Thanks for the suggestion as well. Was a great idea i hadn't thought about when coding this. most of the servers i personally setup have very few accounts so hadn't encountered this but this should correct that going forward.

I need to look into the logic more for this as i meant to add subdomain support but its kinda hard as this is in the db and not a text file which is accessible via root like it is on cPanel.

vpsinghbaghel commented 4 years ago

Thank you for your prompt response. For my current requirements, I had interrupted the script and commented out vmail permission/ownership commands. Then I executed again for -all the accounts. I have around 90+ accounts. So definitely it was a problem for me. I will test with the updated script and will update you. Also I had doubt before running this script because a single small error can take lot of my time manually fixing permissions for large number of sites and a big down time. :) So, I had consulted with CyberPanel support sharing your github link to get their confirmation. Also I had tested on a smaller scale cyberpanel server before running on this one. :) Thank You.