Created
October 17, 2013 21:27
-
-
Save vandorjw/7032471 to your computer and use it in GitHub Desktop.
Reset the permissions on /var/www/
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
###DO NOT USE AS IS, please read the comments### | |
# Debian based systems | |
chown -R www-data:dev-ops /var/www/ | |
chmod -R u+rX-w,g+rwX,o-rwx /var/www/ | |
# RHEL based | |
chown -R apache:dev-ops /var/www/ | |
chmod -R u+rX-w,g+rwX,o-rwx /var/www/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the apache config, we always set a user and group which httpd will run as. Running as root is dangerous.
Checking the apache configuration will give you the user it runs at. I also like to create a group for all the members working on a webprojects. I call this group "dev-ops"
You can create this group by running:
(sh) # groupadd dev-ops
Then add the users you want to be part of that group using
(sh) # usermod -G dev-ops -a user_name
To check which groups your currently running user is already a part of type
(sh) $ groups
The two commands on in the gist will set the owner of each file and directory to the user apache runs as, and sets the group to dev-ops. It then gives the owner read permission (and execute if it is a folder, hence "capital" X).
The dev-op group will have read, write permission, (and execute on folders so we can open them).