TechsRx Logo Top Slice TechsRx Computer Services - Business Stong :: People Friendly
Follow TechsRx on Twitter      TechsRx Facebook Fan Page
TechsRx Logo Bottom Slice Local: 505-897-2996 Toll Free 1.877.TECHS1X (832-4719)
  TechsRx HOME     SUPPORT FORUM        Monday, February 06, 2012 

Set correct permissions on your linux/apache website files and directories

This will help you to easily set correct permissions on your linux/apache website files and directories with one command

As root cd to the ‘document root path’ of your website directory (ie: html, htdocs, httpdocs) and do as follows

find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;

or

find /path/to/docroot/. -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;

this sets all your files to 644 and all your directories to 755

for example,

cd /var/www/html 

find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;

As found at linux-noob.com

Popularity: 100% [?]

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Blogplay
  • Add to favorites
  • MySpace
  • StumbleUpon
  • Twitter

One Response to “Set correct permissions on your linux/apache website files and directories”

  1. Using -exec in “find” is NOT a good idea. It is very slow as find will launch a new process for each and every file it ‘finds’

    Use “xargs” instead.

    find . -type d -print | xargs chmod 775
    find . -type f -print | xargs chmod 664

Leave a Reply

By submitting a comment here you grant TechsRx a perpetual license to reproduce your words and name/web site in attribution.

transparent pixel spacer
BUY NOW   |    LEARN NOW   |    FIX NOW   |    Web Services & Domains   |    4 Color Printing
transparent pixel spacer