Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fix Permission
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run using sudo or as root"
exit
fi
# This Folder
ROOT="$( cd "$(dirname "$0")" ; pwd -P )"
echo $ROOT
function safeMakeFolder() {
local DIRECTORY=$ROOT$1
if [ ! -d "$DIRECTORY" ]; then
mkdir $DIRECTORY
fi
}
find $ROOT -type f | xargs -d '\n' chmod 664
find $ROOT -type d | xargs -d '\n' chmod 775
find $ROOT -type f | xargs -d '\n' chown developer
find $ROOT -type d | xargs -d '\n' chown developer
find $ROOT -type f | xargs -d '\n' chgrp developers
find $ROOT -type d | xargs -d '\n' chgrp developers
chmod 775 "$ROOT/fixPermission.sh"
chmod 775 "$ROOT/index.php"
safeMakeFolder /bin
find "$ROOT/bin/" -type f -iname "*.sh" -exec chmod +x {} \;
safeMakeFolder /var
safeMakeFolder /var/cache
safeMakeFolder /var/emails
safeMakeFolder /var/sessions
safeMakeFolder /var/logs
safeMakeFolder /support
safeMakeFolder /support/keys
safeMakeFolder /support/migrations
chmod -R 775 "$ROOT/var"
chmod -R 775 "$ROOT/support"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.