mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-08-11 23:41:45 +01:00
fix: update CURRENT_USER discovery
change method to use the loginwindow.plist instead of console
This commit is contained in:
@@ -8,7 +8,7 @@ discussion: |
|
||||
The check and fix are for the currently logged in user. To get the currently logged in user, run the following.
|
||||
[source,bash]
|
||||
----
|
||||
CURRENT_USER=$( /usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | /usr/bin/awk '/Name :/ && ! /loginwindow/ { print $3 }' )
|
||||
CURRENT_USER=$( /usr/bin/defaults read /Library/Preferences/com.apple.loginwindow lastUserName )
|
||||
----
|
||||
====
|
||||
references:
|
||||
|
||||
@@ -70,7 +70,7 @@ fi
|
||||
plb="/usr/libexec/PlistBuddy"
|
||||
|
||||
# get the currently logged in user and hostname
|
||||
CURRENT_USER=$( /usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | /usr/bin/awk '/Name :/ && ! /loginwindow/ { print $3 }')
|
||||
CURRENT_USER=$( /usr/bin/defaults read /Library/Preferences/com.apple.loginwindow lastUserName )
|
||||
CURR_USER_UID=$(/usr/bin/id -u $CURRENT_USER)
|
||||
CURR_HOSTNAME=$(/usr/sbin/scutil --get HostName)
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ fi
|
||||
plb="/usr/libexec/PlistBuddy"
|
||||
|
||||
# get the currently logged in user
|
||||
CURRENT_USER=$( /usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | /usr/bin/awk '/Name :/ && ! /loginwindow/ { print $3 }')
|
||||
CURRENT_USER=$( /usr/bin/defaults read /Library/Preferences/com.apple.loginwindow lastUserName )
|
||||
CURR_USER_UID=$(/usr/bin/id -u $CURRENT_USER)
|
||||
|
||||
# get system architecture
|
||||
|
||||
Reference in New Issue
Block a user