RSS Entries RSS
RSS Subscribe by Email

Setting Permissions for Readable Content

Have you ever wanted to have content served up, but it wasn’t readable? Here’s an easy way to recursively set permissions for a web server:

chmod -R a+r ~/www
find ~/www -type d -exec chmod a+x {} \;

Just change ~/www to whatever directory you wish to make readable, and this command will make everything under that directory world-readable and make all directories listable.

Share and Enjoy:
  • Add to favorites
  • HackerNews
  • DZone
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Slashdot
  • Digg
  • Google Bookmarks
  • Facebook

2 Comments »

  1. Sir Bode Rafael said,

    May 13, 2009 at 10:21 pm

    Wouldn’t be better suppling the simplistic chmod way, like this?

    chmod -R 777 /path/to/directory

    Which is equal to:

    chmos -R a=rwx /path/to/directory

    Regards!

  2. Ben said,

    May 16, 2009 at 3:46 pm

    That would make everything readable, writable, and executable by everyone. A preferable approach would be to add read permissions only for the web server.

RSS feed for comments on this post · TrackBack URL

Leave a Comment