shell-things/chmod

60 lines
1.6 KiB
Plaintext
Raw Normal View History

#!/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
GROUP=`id -gn`
2013-02-07 17:17:02 +01:00
wwwdata=`head -n1 wwwuser`
echo "Denying Reading, Writing and eXecuting from other users in"
echo "your home directory $HOME ."
echo ""
chmod g-rwx,o-rwx $HOME -R
echo "Creating empty oidentd user configuration file, if it doesn't"
echo "already exist."
echo ""
touch ~/.oidentd.conf
echo "Allowing other users to read oidentd configuration file."
chmod u+rw,g-wx+r,o-wx+r ~/.oidentd.conf
echo ""
echo "Denying directory listing from other users and allowing them to"
echo "access files/folders where they have permissions."
touch ~/.ICEauthority
chmod o-rw+x,g-rw+x ~
echo ""
echo "Creating apache2 UserDir..."
2013-02-06 15:54:38 +01:00
mkdir -p ~/public_html/
echo ""
echo "Allowing everyone to Read and eXecute everything in your apache2"
echo "userdir and hoping that we are the only user in group $GROUP..."
chmod o+rx-w,g+rxw ~/public_html/ -R
echo ""
2013-02-20 16:03:41 +01:00
echo "Setting correct permissions to other files which others should access."
2013-02-07 06:22:51 +01:00
touch ~/.face
touch ~/.forward
echo ""
2013-02-07 06:22:51 +01:00
chmod a+r-wx,u+rw ~/.face
chmod a+r-wx,u+rw ~/.forward
echo "Setting access lists. This requires package acl to be installed"
echo "and kernel support for it and mount point being mounted with option"
echo "acl"
echo ""
setfacl -R -m u:$wwwdata:rwx ~/public_html
setfacl -R -m d:u:$wwwdata:rwx ~/public_html
if [ -f chmod.2 ]; then
./chmod.2
fi
echo "Everything is now done :)"