root is able to use
sudo to “become” any other user—this may be a way to deploy a script as the active user.
Please note: The script running will need to know which user to
sudo to. So if you wanted to go this path, you'd want to run something like '
stat -f "%Su" /dev/console' so you can set that as a variable and then use it with
CURRENTLY_LOGGEDON_USER=$(stat -f "%Su" /dev/console)
⚡️ IMPORTANT! ⚡️ The above is only an example. Please extensively test and debug a custom bash script before deploying it to your fleet.