@@ -13,6 +13,11 @@ fn_check_ownership() {
1313 selfownissue=1
1414 fi
1515 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
1621 if [ -d " ${modulesdir} " ]; then
1722 if [ " $( find " ${modulesdir} " -not -name ' *.swp' -not -user " $( whoami) " | wc -l) " -ne " 0" ]; then
1823 funcownissue=1
@@ -23,18 +28,18 @@ fn_check_ownership() {
2328 filesownissue=1
2429 fi
2530 fi
26- if [ " ${selfownissue} " == " 1" ] || [ " ${funcownissue } " == " 1" ] || [ " ${filesownissue} " == " 1" ]; then
31+ if [ " ${selfownissue} " == " 1" ] || [ " ${lgsmownissue } " == " 1" ] || [ " ${filesownissue} " == " 1" ]; then
2732 fn_print_fail_nl " Ownership issues found"
2833 fn_script_log_fail " Ownership issues found"
2934 fn_print_information_nl " The current user ($( whoami) ) does not have ownership of the following files:"
3035 fn_script_log_info " The current user ($( whoami) ) does not have ownership of the following files:"
3136 {
32- echo -e " User\tGroup\tFile\n "
37+ echo -en " User\tGroup\tFile: "
3338 if [ " ${selfownissue} " == " 1" ]; then
3439 find " ${rootdir} /${selfname} " -not -user " $( whoami) " -printf " %u\t%g\t%p\n"
3540 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"
3843 fi
3944 if [ " ${filesownissue} " == " 1" ]; then
4045 find " ${serverfiles} " -not -user " $( whoami) " -printf " %u\t%g\t%p\n"
@@ -53,15 +58,18 @@ fn_check_ownership() {
5358}
5459
5560fn_check_permissions () {
61+ # Check modules files are executable.
5662 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
5866 fn_print_fail_nl " Permissions issues found"
5967 fn_script_log_fail " Permissions issues found"
6068 fn_print_information_nl " The following files are not executable:"
6169 fn_script_log_info " The following files are not executable:"
6270 {
63- echo -e " File\n "
64- find " ${modulesdir} " -type f -not -executable -printf " %p\n "
71+ echo -en " File: "
72+ echo -en " ${findnotexecutable} "
6573 } | column -s $' \t ' -t | tee -a " ${lgsmlog} "
6674 if [ " ${monitorflag} " == 1 ]; then
6775 alert=" permissions"
@@ -72,8 +80,8 @@ fn_check_permissions() {
7280 fi
7381
7482 # 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.
7785 rootdirperm=$( stat -c %a " ${rootdir} " )
7886 # Grab the first and second digit for user and group permission.
7987 userrootdirperm=" ${rootdirperm: 0: 1} "
@@ -92,6 +100,7 @@ fn_check_permissions() {
92100 core_exit.sh
93101 fi
94102 fi
103+
95104 # Check if executable is executable and attempt to fix it.
96105 # First get executable name.
97106 execname=$( basename " ${executable} " )
@@ -141,7 +150,7 @@ fn_check_permissions() {
141150 fi
142151}
143152
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.
145154
146155# Checks for permission errors in /sys directory.
147156fn_sys_perm_errors_detect () {
0 commit comments