KACE run script as user on macOS
I see the possibility to run a script as
local system
logged in user
or specify credentials
but only on Windows. I need to run a script in the user context on macOS. How can I achieve this?
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
horacior
2 years ago
Try this. The line goes at the top of the macOS scripts, and It has been working fine with my scripts.
One thing to consider is, if you have several "sudos" or commands that you need to be executed within the script, you might need to repeat that line right before these commands run.
# Pull current logged in user into 'user' variable.
user=`ls -l /dev/console | cut -d " " -f 4`
I hope it helps.