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 ...

Get Linux® Quick Fix Notebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.