-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpermission
executable file
·40 lines (32 loc) · 1.18 KB
/
permission
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
#!/bin/bash
# Text Reset
RESET='\e[0m'
BLINK='\e[5m'
# Regular Colors
BLACK='\e[0;30m'
RED='\e[0;31m'
GREEN='\e[0;32m'
YELLOW='\e[0;33m'
BLUE='\e[0;34m'
PURPLE='\e[0;35m'
CYAN='\e[0;36m'
WHITE='\e[0;37m'
clear
echo -e "${CYAN}=================================================================${RESET}"
echo -e "${GREEN} Directory Permissions!! ${RESET}"
echo -e "${CYAN}=================================================================${RESET}"
if [ "$1" != "" ]; then
sudo chown $USER:www-data -R $1
echo -e "${YELLOW}Change $1 directory owner to $USER:www-data${RESET}"
sudo find $1 -type d -exec chmod 755 {} \;
echo -e "${YELLOW}Change $1 directory permissions 755'${RESET}"
sudo find $1 -type f -exec chmod 644 {} \;
echo -e "${YELLOW}Change $1 file permissions 644${RESET}"
else
sudo chown www-data:www-data -R *
echo -e "${YELLOW}Change current directory owner to www-data:www-data${RESET}"
sudo find . -type d -exec chmod 755 {} \;
echo -e "${YELLOW}Change current directory permissions 755${RESET}"
sudo find . -type f -exec chmod 644 {} \;
echo -e "${YELLOW}Change current file permissions 644${RESET}"
fi