O'Reilly logo

Linux® Quick Fix Notebook by Peter Harrison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix II. Codes, Scripts, and Configurations

This appendix contains samples of all the scripts used in the previous chapters.

Apache File Permissions Script

The first argument of the script is the target directory and must have a trailing /. The script prints an on-screen list of all the files it has modified.

     [root@bigboy tmp]# ./fix-www-perms.sh /home/www/webpages/
     /home/www/webpages/
     /home/www/webpages/file1.htm
     /home/www/webpages/file2.htm
     ...
        ...
        ...
     [root@bigboy tmp]

Here’s how it’s done:

 #!/bin/sh # # fix-www-perms.sh - Recursively fixes file permissions in a www directory # so that Apache may serve the pages correctly # # (c) SiliconValleyCCIE.com # for i in `find $1` do if [ -d $i ] ; then chmod 755 $i echo $i else chmod 644 $i echo ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required