diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2016-07-05 13:11:38 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2016-07-05 13:11:38 +0300 |
commit | b5b8861368cef8934fbe18c23f5918544e4f8be5 (patch) | |
tree | 4bb2e5403846cad469d5043c8b72623c2f550e83 /lynis | |
parent | 72ca2b926dde98b726a28119e26de33db30a2ef0 (diff) |
Improve ID detection for Solaris
Diffstat (limited to 'lynis')
-rwxr-xr-x | lynis | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -107,9 +107,11 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta MYID="" # Check user to determine file permissions later on. If we encounter Solaris, use related id binary instead if [ -x /usr/xpg4/bin/id ]; then - MYID=`/usr/xpg4/bin/id -u 2> /dev/null` - else - MYID=`id -u 2> /dev/null` + MYID=$(/usr/xpg4/bin/id -u 2> /dev/null) + elif [ `uname` = "SunOS" ]; then + MYID=$(id | tr '=' ' ' | tr '(' ' ' | awk '{ print $2 }' 2> /dev/null) + else + MYID=$(id -u 2> /dev/null) fi if [ "${MYID}" = "" ]; then Display "Could not find user ID with id command. Want to help improving Lynis? Raise a ticket at ${PROGRAM_SOURCE}"; ExitFatal; fi # |