-
Notifications
You must be signed in to change notification settings - Fork 154
/
world_writable.ksh
49 lines (36 loc) · 924 Bytes
/
world_writable.ksh
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
#!/bin/ksh
# Script Name : world_writable.ksh
# Author : Craig Richards
# Created : 28-November-2007
# Last Modified : 28 January 2008
# Version : 1.1
# Modifications : 28th-Jan-2008 - CR - Added the function to check the user ROOT is running the program
# Description : Shows all world writable file
#################################
# Start of procedures/functions #
#################################
funct_check_user()
{
ID=$(/usr/ucb/whoami)
if [ $ID != "root" ]; then
echo "$ID, You must be root to run"
exit 1
fi
}
find_world_writable_dir()
{
find / -type d -perm -o+w -ls 2> /dev/null 1> $OUTPUT_DIR/world.txt
}
################
# Main Program #
################
# Variable Settings
NARG=$# ; export NARG
DATE=`date +"%d-%B-%Y"` ; export DATE
OUTPUT_DIR=/admin/output ; export OUTPUT_DIR
# Oracle Environment
{
funct_check_user
find_world_writable_dir
}
## End of Program