-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcheck_permission
executable file
·53 lines (49 loc) · 1.01 KB
/
check_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
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
source_functions()
{
. conf/itennis.conf
. scripts/log_print
. scripts/exec_remote
}
source_functions
CMDS_LIST=/tmp/cmds_list.$$
CONF_LIST=${HOSTS_CONF}
BG='n'
read -p "please input permission value [e.g. 750 or !750]: "
perm=${REPLY}
if [ "$perm" == "" ];
then
log ERROR "permission is not null"
exit
fi
if [[ "`echo $perm | cut -c 1`" == '!' ]];then
dnots='!'
perm=`echo $perm | cut -c2-${#perm}`
fi
read -p "please input director value [e.g. /tmp]: "
dir=$REPLY
if [ "$dir" == "" ];
then
log ERROR "director is not null"
exit
fi
read -p "please input user value [e.g. root or !root]: "
users=$REPLY
if [[ "$users" == "" ]];then
utmp=""
else
if [[ "`echo $users | cut -c 1`" == '!' ]];then
unots='!'
users=`echo $users | cut -c2-${#users}`
utmp="$unots -user $users"
else
utmp="-user $users"
fi
fi
(
cat << EOF
find $dir $dnots -perm ${perm} $utmp -ls
EOF
) > ${CMDS_LIST}
sh exec_morelist.sh ${CONF_LIST} ${CMDS_LIST} $bg
rm /tmp/*.$$