#!/bin/bash
# http://www.crystalfaeries.net/linux/bin/private
# Released under GNU GPL v.3 by celeste:crystalfaery
# 2011-08-17 17:10:06+00:00
echo -n "shall I recursively normalize file ownership and permissions for private access? (NO/yes):"
read answer
if [ "$answer" != "yes" ]
then exit 0 # unless user answers "yes" we just quit
fi
user=`whoami`
group=`whoami`
dirs=2771
files=660
sudo find . \! -user $user -print -exec chown $user:$group {} \;
sudo find . \! -group $group -print -exec chgrp $group {} \;
sudo find . -type d \! -perm $dirs -print -exec chmod $dirs {} \;
sudo find . -type f \! -perm $files -print -exec chmod $files {} \;
syntax highlighted by Code2HTML, v. 0.9.1