Posted on 05-02-2021 11:47 PM
Hello,
i have a package file which contains an .app binary with it, I need user level ownership for .app in order to perform some execution which is not possible without authorization with system ownership. Currently when i deploy the package jamf deploys it with system ownership. I have a post installation script in my package file which change the ownership from system to user but this script does not seems to work. I tried to run the package locally and in this case the script executes successfully. Is there any way to change ownership of the payload?
Posted on 05-03-2021 05:55 AM
How are you determining the user when changing ownership? Remember that Jamf installs run as root, not as the user.
You might want to post your post-install script (sanitized if necessary) so others can take a look.
Posted on 05-04-2021 12:40 AM
@RBlount I am getting user in post script and adding ownership for this user. Attached is the script which i am using.
Posted on 05-04-2021 04:49 AM
You can't use $USER
in a Jamf Pro script, at least not for what you're trying to do. As @RBlount mentioned, this gets the user running the script, which would be root, not the logged in user account. Use something like this to get the logged in user
LoggedInUser=$(/usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ {print $3}')
Posted on 05-05-2021 12:34 AM
@mm2270 do i need to install this utility "scutil" or is it available by default in all OSX?
Posted on 05-05-2021 04:29 AM
@slashnext It's there by default in all versions of macOS.