-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathchmod
More file actions
executable file
·65 lines (51 loc) · 1.76 KB
/
chmod
File metadata and controls
executable file
·65 lines (51 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/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.
set -x
# You don't want to make this verbose.
chmod g-rwx,o-rwx "$HOME" -R
touch $HOME/.oidentd.conf
chmod -v u+rw,g-wx+r,o-wx+r $HOME/.oidentd.conf
touch $HOME/.ICEauthority
chmod -v o-rw+x,g-rw+x $HOME
mkdir -p $HOME/public_html/
chmod -v -R 755 $HOME/public_html/
touch $HOME/.face
touch $HOME/.forward
touch $HOME/.netrc
chmod -v a+r-wx,u+rw $HOME/.face
chmod -v a+r-wx,u+rw $HOME/.forward
chmod -v 600 $HOME/.netrc
mkdir -p $HOME/.ssh
chmod -v 700 $HOME/.ssh
touch $HOME/.ssh/authorized_keys
chmod -v 600 $HOME/.ssh/authorized_keys
mkdir -p "$HOME/AppImages"
chmod a+rx "$HOME/AppImages/" "$HOME/AppImages/*.appimage"
if [ -d "$HOME/.config/autostart-scripts" ]; then
chmod -v +x "$HOME/.config/autostart-scripts/*"
fi
if [ -d "$HOME/.config/old-autostart-scripts" ]; then
chmod -v +x "$HOME/.config/old-autostart-scripts/*"
fi
# if we have support for setting ACL, some of this becomes easier (although maybe redundant)
if hash setfacl 2> /dev/null; then
setfacl --modify u:$(id -un):rw,g:$(id -gn):r,o:r $HOME/.oidentd.conf
setfacl --modify=u:$(id -un):rwX,g:$(id -gn):rX,o:rX "$HOME/AppImages/"
setfacl --recursive --modify u:$(id -un):rwX,g:$(id -gn):rX,o:rX $HOME/public_html/
for appimage in $(find $HOME/AppImages/*.appimage); do
setfacl --modify=u:$(id -un):rwX,g:$(id -gn):rX,o:rX $appimage
done
# Enabling laziness pt. …
if [[ -d $HOME/.shell-things ]]; then
setfacl --recursive --modify u:$(id -un):rwX,g:$(id -gn):rX,o:rX $HOME/.shell-things/
fi
fi
# Fedora Atomic compatibility
if [ "$(id -u)" == "0" ]; then
if [ -d /var/roothome ]; then
chmod -v a+x /var/roothome
fi
fi
set +x