in reply to Insecure dependency in chmod while running setuid

Why bother with Perl? Something like:
#!/usr/bin/sh TOPDIR="/var/www/test" find $TOPDIR -type f -print0 | xargs -0 chmod 664 find $TOPDIR -type d -print0 | xargs -0 chmod 2775 chown -R -1:1005 $TOPDIR
ought to do the trick.