Recommended file permissions for /var/www/html

Posted on 2007-10-19
Last Modified: 2013-12-16
Hello Experts - Linux Newbie with a question.

I am running Fedora5 with Apache2 and have a question about file permissions.   I want to allow developers the ability to SSH in and modify files.  I am using /var/ww/html directory and each website in a subdirectory has permissions of 755 with Owner=root and Group=Apache.

When the developers SSH in they are unable to edit or modify the files.  Right now they have to SU as root.  I used webmin and changed their primary group to root but that still didn't work.  Right now they are having to su as root. I'd prefer to have them use their regular account.  I was trying not to change the permissions of the files from root:apache for fear of breaking something on the website.

Question by:codefaze
    LVL 48

    Accepted Solution

    What'd I'd do is create a new group, eg: webdev, then do

    chgrp -R webdev /var/www/html
    chmod -R g+w /var/www/html

    then put whatever users who need edit rights to the files under /var/www/html in the webdev group.
    LVL 12

    Expert Comment

    u have to add developer user to the apache group
    usermod -g developer apache

    Before that delete the developer user from the root group.
    LVL 50

    Expert Comment

    by:Steve Bink
    I use Tintin's method.  I have a group called webowner which owns all files and directories in the document roots for my various sites.  At the user level, all are owned by Apache's user.

    ibu1's solution creates a vulnerability by allowing developers to change files used for the apache server itself.  No one but apache should be part of apache's group.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
    ​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now