-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpermissions.sh
More file actions
67 lines (48 loc) · 2.28 KB
/
permissions.sh
File metadata and controls
67 lines (48 loc) · 2.28 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
66
67
#!/usr/bin/env bash
#----------------------------------------------------------------------------------
# EngineScript - A High-Performance WordPress Server Built on Ubuntu and Cloudflare
#----------------------------------------------------------------------------------
# Website: https://EngineScript.com
# GitHub: https://github.com/Enginescript/EngineScript
# License: GPL v3.0
#----------------------------------------------------------------------------------
# EngineScript Variables
source /usr/local/bin/enginescript/enginescript-variables.txt || { echo "Error: Failed to source /usr/local/bin/enginescript/enginescript-variables.txt" >&2; exit 1; }
source /home/EngineScript/enginescript-install-options.txt || { echo "Error: Failed to source /home/EngineScript/enginescript-install-options.txt" >&2; exit 1; }
# Source shared functions library
source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh || { echo "Error: Failed to source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.sh" >&2; exit 1; }
#----------------------------------------------------------------------------------
# Start Main Script
#----------------------------------------------------------------------------
# Forked from https://github.com/A5hleyRich/simple-automated-tasks
# Include config
source /home/EngineScript/sites-list/sites.sh
for i in "${SITES[@]}"
do
cd "/var/www/sites/$i/html"
# Directories
find . -type d -print0 | sudo xargs -0 chmod 0755
# Files
find . -type f -print0 | sudo xargs -0 chmod 0644
# wp-config.php
chmod 600 wp-config.php
# Ownership
chown -R www-data:www-data ./*
# Make wp-cron executable
chmod +x wp-cron.php
done
# Assign Nginx Permissions
set_nginx_permissions
# Assign PHP Permissions
set_php_permissions
# Ensure correct socket ownership and permissions
chown redis:redis /run/redis/redis-server.sock 2>/dev/null || true
chmod 770 /run/redis/redis-server.sock 2>/dev/null || true
# Convert line endings
dos2unix /usr/local/bin/enginescript/*
# Set directory and file permissions to 755
find /usr/local/bin/enginescript -exec chmod 755 {} \;
# Set ownership
chown -R root:root /usr/local/bin/enginescript
# Make shell scripts executable
find /usr/local/bin/enginescript -type f -iname "*.sh" -exec chmod +x {} \;