Last active
March 16, 2016 19:24
-
-
Save phpdave/ce6b86a9d98e7675f2df to your computer and use it in GitHub Desktop.
functions to add to your shell profile to easily manage file permissions. Can then do "git pull && http-permissions" to make sure your files have the write permissions. Thanks to Josh Hall for the idea to add the functions to shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Parameter ${1} is the directory you want to effect like /www/zendsvr/htdocs/ or /www/zendsvr/writeable/uploads | |
function http-permissions() { | |
system -i "CHGAUT OBJ('${1}') USER(NOGROUP) DTAAUT(*RX) OBJAUT(*NONE) SUBTREE(*ALL)" | |
system -i "CHGPGP OBJ('${1}') NEWPGP(NOGROUP) RVKOLDAUT(*NO) SUBTREE(*ALL)" | |
#Usage: on the command line | |
#http-permissions /www/zendsvr/htdocs/ | |
#/www/zendsvr/htdocs/ will be given permissions recursively to the apache group | |
} | |
function http-write-permissions() { | |
system -i "CHGAUT OBJ('${1}') USER(QTMHHTTP) DTAAUT(*RWX) OBJAUT(*NONE) SUBTREE(*NO)" | |
} | |
function remove-public-permissions() { | |
system -i "CHGAUT OBJ('${1}') USER(*PUBLIC) DTAAUT(*NONE) OBJAUT(*NONE) SUBTREE(*ALL)" | |
#in case someone incorrectly gave public permissions | |
} | |
function developer-permissions() { | |
system -i "CHGOWN OBJ('${1}') NEWOWN(WEBCODERS) RVKOLDAUT(*NO) SUBTREE(*ALL)" | |
system -i "CHGAUT OBJ('${1}') USER(WEBCODERS) DTAAUT(*RWX) OBJAUT(*ALL) SUBTREE(*ALL)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment