shell-things/chmod
Mikaela Suomalainen 0b84baae26 chmod: following fixes
* Be verbose
* fix command nesting
* chmod ~/public_html to 755 (for php)
* create netrc and set permissions to 600
2014-07-16 13:09:59 +03:00

44 lines
868 B
Bash
Executable File

#!/usr/bin/env bash
# This script removes permissions from other people than the owner to
# files/folders that they don't have access to and where they don't need
# access.
## THIS SCRIPT HAS MOVED TO SHELL-THINGS AS "chmod"!
## https://raw.github.com/Mkaysi/shell-things/master/chmod
set -x
GROUP=$(id -gn)
wwwdata=$(head -n1 wwwuser)
setfacl=$(locate setfacl|grep bin|head -n1)
chmod g-rwx,o-rwx $HOME -R
touch ~/.oidentd.conf
chmod u+rw,g-wx+r,o-wx+r ~/.oidentd.conf
touch ~/.ICEauthority
chmod o-rw+x,g-rw+x ~
mkdir -p ~/public_html/
chmod -R 755 ~/public_html/
touch ~/.face
touch ~/.forward
touch ~/.netrc
echo ""
chmod a+r-wx,u+rw ~/.face
chmod a+r-wx,u+rw ~/.forward
chmod 600 ~/.netrc
if [[ -f $setfacl ]]; then
setfacl -R -m u:$wwwdata:rwx ~/public_html
setfacl -R -m d:u:$wwwdata:rwx ~/public_html
fi
if [ -f chmod.2 ]; then
./chmod.2
fi