peachflame / cpanel-fixperms Goto Github PK
View Code? Open in Web Editor NEWA script to fix permissions & ownership, on files & directories, for cPanel accounts.
License: GNU General Public License v3.0
A script to fix permissions & ownership, on files & directories, for cPanel accounts.
License: GNU General Public License v3.0
We should add an option to backup of existing permission and ownership for all users.
Below is code snippet for your review.
backupdir="/root/fixperms_backups/fixperms_backups_'date +%s'"
mkdir -p $backupdir
function permsbkp
{
local user=$1
local home_dir=$2
echo "Backing up permissions for $user"
find $home_dir -printf 'chmod %#m "%p"\n' > ${backupdir}/${user}-perms_backup_'date +%s'.sh
echo "Backing up ownerships for $user"
find $home_dir -printf 'chown %u:%g "%p"\n' > ${backupdir}/${user}-owners_backup_'date +%s'.sh
}
In abuse situations, we sometimes have to temporarily set files to 000 until customers have a chance to take care of the problem.
Generally, when files are left in that state, it's best that they be left in that state until manually corrected after the abuse issue is resolved.
I'm not sure you'd want it to be the default, but having an option to skip over any file/directory that's set to 000 would be a nice safety net here. Generally, when you run across that, it's been explicitly set that way, not by accident.
script gets stuck in loop with the cpanel user system.
from the script output;
Fixing website files....
find: ‘/public_html’: No such file or directory
find: ‘/public_html’: No such file or directory
find: ‘/public_html’: No such file or directory
chown: invalid user: ‘system:system’
chown: invalid user: ‘system.system’
chown: invalid user: ‘system.system’
chown: invalid user: ‘system.system’
........ etc
./fixperms.sh: line 24: $'\r': command not found
./fixperms.sh: line 25: $'\r': command not found
./fixperms.sh: line 28: $'\r': command not found
./fixperms.sh: line 29: $'\r': command not found
./fixperms.sh: line 31: syntax error near unexpected token $'{\r'' '/fixperms.sh: line 31:
helptext () {
Hi,
This script does not seem to work correctly when accounts are in alternate home directories like /home2.
Thanks
hi, i'm receiving the following error when i run this script. seems like a path parsing issue?
chown: cannot access ‘On"}]}},"enable_sni_for_mail":"1","group":"xyz","owner":"root","usecanonicalname":"Off","customlog":[{"target":"/etc/apache2/logs/domlogs/xyz.xyzhosting.com","format":"combined"}],"documentroot":"/home/xyz/xyz-websites/xyzhosting","sslcertificatefile":"/var/cpanel/ssl/installed/certs/_wildcard__xyzhosting_com_cbc7b_7ab37_1533513599_4b02ce0d75f4eae7d6dab9986e65cd4e.crt","secruleengineoff":null,"ifmodulemodsuphpc":{"group":"xyz"},"options":"-ExecCGI’: No such file or directory
find: ‘On"}]}},"enable_sni_for_mail":"1","group":"xyz","owner":"root","usecanonicalname":"Off","customlog":[{"target":"/etc/apache2/logs/domlogs/xyz.xyzhosting.com","format":"combined"}],"documentroot":"/home/xyz/xyz-websites/xyzhosting","sslcertificatefile":"/var/cpanel/ssl/installed/certs/_wildcard__xyzhosting_com_cbc7b_7ab37_1533513599_4b02ce0d75f4eae7d6dab9986e65cd4e.crt","secruleengineoff":null,"ifmodulemodsuphpc":{"group":"xyz"},"options":"-ExecCGI’: No such file or directory
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.