-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfix_permissions.sh
79 lines (63 loc) · 1.98 KB
/
fix_permissions.sh
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
#-----------------------------
# Version 0.0.13
# Updated: 12/28/2022
#
#
# Cron:
# 0 */2 * * * chmod u+x fix_permission.sh
# 0 */2 * * * fix_permissions.sh
#-----------------------------
echo "Fixing Permissions on various dir's. This may take a minute...
"
if [ -d "/media/data/sync/" ]
then
echo " working on: /media/data/sync/* ... "
#--- needed for Resilio ----
sudo chmod -R 775 /media/data/sync/
sudo chown -R rslsync:rslsync /media/data/sync/
#sudo chmod -R 755 /media/data/sync/
#sudo chown -R www-data:www-data /media/data/sync/
echo " Done!
"
fi
# Fixes http permissions - 640 or 755
if [ -d "/var/www" ]
then
echo " working on: /var/www/* ... "
Web_path='/var/www'
#chmod 0644 ${Web_path}/.htaccess
#chmod 0644 ${Web_path}/data/.htaccess
sudo chmod -R 755 ${Web_path}
sudo chown -R www-data:www-data ${Web_path}
chown -R ${rootuser}:${htgroup} ${Web_path}/
chown -R 'ubuntu':${htgroup} ${Web_path}/
echo " Done!
"
fi
# if [ -d "/var/www/nextcloud" ]
# then
# htuser='www-data'
# htgroup='www-data'
# rootuser='root'
# ocpath='/var/www/nextcloud'
# find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
# find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750
# chown -R ${rootuser}:${htgroup} ${ocpath}/
# chown -R ${htuser}:${htgroup} ${ocpath}/apps/
# chown -R ${htuser}:${htgroup} ${ocpath}/config/
# chown -R ${htuser}:${htgroup} ${ocpath}/data/
# chown -R ${htuser}:${htgroup} ${ocpath}/themes/
# chown ${rootuser}:${htgroup} ${ocpath}/.htaccess
# chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess
# chmod 0644 ${ocpath}/.htaccess
# chmod 0644 ${ocpath}/data/.htaccess
# sudo chmod -R 755 ${ocpath}
# sudo chown -R www-data:www-data ${ocpath}
# fi
#--- General commands -----
#echo "\r\n \r\n"
#echo "All users on the system: \r\n "
#cat /etc/passwd
#echo "All Groups on the system: \r\n "
#cut -d: -f1 /etc/group | sort