Posted on 02-10-2022 06:30 AM
I am getting an error using the scripts pointing to permissions.
I have tried the below
#!/bin/sh
loggedInUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");'`
echo $loggedInUser
sudo -u $loggedInUser brew install --cask citrix-workspace
I get the below error
Script result: File "<string>", line 1
from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + " ^ SyntaxError: EOL while scanning string literal sudo: unknown user: brew sudo: error initializing audit plugin sudoers_audit
Any thoughts on the code i am using i see others used it successfully....