@@ -13,6 +13,11 @@ fn_check_ownership() {
13
13
selfownissue=1
14
14
fi
15
15
fi
16
+ if [ -d " ${lgsmdir} " ]; then
17
+ if [ " $( find " ${lgsmdir} " -not -user " $( whoami) " | wc -l) " -ne " 0" ]; then
18
+ lgsmownissue=1
19
+ fi
20
+ fi
16
21
if [ -d " ${modulesdir} " ]; then
17
22
if [ " $( find " ${modulesdir} " -not -name ' *.swp' -not -user " $( whoami) " | wc -l) " -ne " 0" ]; then
18
23
funcownissue=1
@@ -23,18 +28,18 @@ fn_check_ownership() {
23
28
filesownissue=1
24
29
fi
25
30
fi
26
- if [ " ${selfownissue} " == " 1" ] || [ " ${funcownissue } " == " 1" ] || [ " ${filesownissue} " == " 1" ]; then
31
+ if [ " ${selfownissue} " == " 1" ] || [ " ${lgsmownissue } " == " 1" ] || [ " ${filesownissue} " == " 1" ]; then
27
32
fn_print_fail_nl " Ownership issues found"
28
33
fn_script_log_fail " Ownership issues found"
29
34
fn_print_information_nl " The current user ($( whoami) ) does not have ownership of the following files:"
30
35
fn_script_log_info " The current user ($( whoami) ) does not have ownership of the following files:"
31
36
{
32
- echo -e " User\tGroup\tFile\n "
37
+ echo -en " User\tGroup\tFile: "
33
38
if [ " ${selfownissue} " == " 1" ]; then
34
39
find " ${rootdir} /${selfname} " -not -user " $( whoami) " -printf " %u\t%g\t%p\n"
35
40
fi
36
- if [ " ${funcownissue } " == " 1" ]; then
37
- find " ${modulesdir } " -not -user " $( whoami) " -printf " %u\t%g\t%p\n"
41
+ if [ " ${lgsmownissue } " == " 1" ]; then
42
+ find " ${lgsmdir } " -not -user " $( whoami) " -printf " %u\t%g\t%p\n"
38
43
fi
39
44
if [ " ${filesownissue} " == " 1" ]; then
40
45
find " ${serverfiles} " -not -user " $( whoami) " -printf " %u\t%g\t%p\n"
@@ -53,15 +58,18 @@ fn_check_ownership() {
53
58
}
54
59
55
60
fn_check_permissions () {
61
+ # Check modules files are executable.
56
62
if [ -d " ${modulesdir} " ]; then
57
- if [ " $( find " ${modulesdir} " -type f -not -executable | wc -l) " -ne " 0" ]; then
63
+ findnotexecutable=" $( find " ${modulesdir} " -type f -not -executable) "
64
+ findnotexecutablewc=" $( echo " ${findnotexecutable} " | wc -l) "
65
+ if [ " ${findnotexecutablewc} " -ne " 0" ]; then
58
66
fn_print_fail_nl " Permissions issues found"
59
67
fn_script_log_fail " Permissions issues found"
60
68
fn_print_information_nl " The following files are not executable:"
61
69
fn_script_log_info " The following files are not executable:"
62
70
{
63
- echo -e " File\n "
64
- find " ${modulesdir} " -type f -not -executable -printf " %p\n "
71
+ echo -en " File: "
72
+ echo -en " ${findnotexecutable} "
65
73
} | column -s $' \t ' -t | tee -a " ${lgsmlog} "
66
74
if [ " ${monitorflag} " == 1 ]; then
67
75
alert=" permissions"
@@ -72,8 +80,8 @@ fn_check_permissions() {
72
80
fi
73
81
74
82
# Check rootdir permissions.
75
- if [ " ${rootdir} " ]; then
76
- # Get permission numbers on directory under the form 775.
83
+ if [ -d " ${rootdir} " ]; then
84
+ # Get permission numbers on directory should return 775.
77
85
rootdirperm=$( stat -c %a " ${rootdir} " )
78
86
# Grab the first and second digit for user and group permission.
79
87
userrootdirperm=" ${rootdirperm: 0: 1} "
@@ -92,6 +100,7 @@ fn_check_permissions() {
92
100
core_exit.sh
93
101
fi
94
102
fi
103
+
95
104
# Check if executable is executable and attempt to fix it.
96
105
# First get executable name.
97
106
execname=$( basename " ${executable} " )
@@ -141,7 +150,7 @@ fn_check_permissions() {
141
150
fi
142
151
}
143
152
144
- # # The following fn_sys_perm_* modules checks for permission errors in /sys directory.
153
+ # # The following fn_sys_perm_* function checks for permission errors in /sys directory.
145
154
146
155
# Checks for permission errors in /sys directory.
147
156
fn_sys_perm_errors_detect () {
0 commit comments