| 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 your server, chmod 755, and pass the usernames as arguments: ./fixperms user1 user2 user3 You can also run a server-wide loop like this: for i in `ls -A /var/cpanel/users` ; do ./fixperms $i ; done Below is the script, but I recommend downloading it from here to ensure that the formatting is correct. #!/bin/bash if [ "$#" -lt "1" ];then USER=$@ for user in $USER HOMEDIR=$(grep $user /etc/passwd | cut -d: -f6) if [ ! -f /var/cpanel/users/$user ]; then elif [ "$HOMEDIR" == "" ];then else echo "Setting ownership for user $user" chown -R $user:$user $HOMEDIR echo "Setting permissions for user $USER" find $HOMEDIR -type f -exec chmod 644 {} \; -print
|
Powered by WHMCompleteSolution