2013-02-06 15:45:29 +01:00
|
|
|
#!/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
|
2014-07-16 12:09:59 +02:00
|
|
|
set -x
|
2013-02-06 15:45:29 +01:00
|
|
|
|
2014-07-16 12:09:59 +02:00
|
|
|
GROUP=$(id -gn)
|
2013-02-07 17:13:45 +01:00
|
|
|
|
2014-07-16 12:09:59 +02:00
|
|
|
wwwdata=$(head -n1 wwwuser)
|
2013-02-07 17:13:45 +01:00
|
|
|
|
2014-07-16 12:09:59 +02:00
|
|
|
setfacl=$(locate setfacl|grep bin|head -n1)
|
2014-05-01 14:06:44 +02:00
|
|
|
|
2013-02-06 15:45:29 +01:00
|
|
|
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 ~
|
|
|
|
|
2013-02-06 15:54:38 +01:00
|
|
|
mkdir -p ~/public_html/
|
2014-07-16 12:09:59 +02:00
|
|
|
chmod -R 755 ~/public_html/
|
2013-02-07 06:21:59 +01:00
|
|
|
|
2013-02-07 06:22:51 +01:00
|
|
|
touch ~/.face
|
|
|
|
touch ~/.forward
|
2014-07-16 12:09:59 +02:00
|
|
|
touch ~/.netrc
|
2013-02-07 17:13:45 +01:00
|
|
|
echo ""
|
2013-02-07 06:22:51 +01:00
|
|
|
chmod a+r-wx,u+rw ~/.face
|
|
|
|
chmod a+r-wx,u+rw ~/.forward
|
2014-07-16 12:09:59 +02:00
|
|
|
chmod 600 ~/.netrc
|
2013-02-07 06:21:59 +01:00
|
|
|
|
2014-05-01 14:06:44 +02:00
|
|
|
if [[ -f $setfacl ]]; then
|
2013-02-07 17:13:45 +01:00
|
|
|
setfacl -R -m u:$wwwdata:rwx ~/public_html
|
|
|
|
setfacl -R -m d:u:$wwwdata:rwx ~/public_html
|
2014-05-01 14:06:44 +02:00
|
|
|
fi
|
2013-02-07 17:13:45 +01:00
|
|
|
|
|
|
|
if [ -f chmod.2 ]; then
|
|
|
|
./chmod.2
|
2014-05-01 14:06:44 +02:00
|
|
|
fi
|
2013-02-07 17:13:45 +01:00
|
|
|
|