#!/bin/bash [ "root" != "$USER" ] && exec sudo $0 "$@" webdir=/var/www www_group=www-data userfriend=princesspi find "$webdir" -type d -exec chmod 775 {} \; find "$webdir" -type f -exec chmod 664 {} \; find "$webdir" -type f -iname "*.sh" -exec chmod 775 {} \; chown -R $userfriend:$www_group "$webdir"