Skip to main content

We are deploying some software that prompts for local admin credentials when executed, which is problematic as most of our users have Standard accounts. I wrote up these couple of lines in bash:



#!/bin/bash
#Runs $PROGRAM as localadmin admin account to avoid requiring admin rights
sudo -u localadmin open /Applications/Utilities/PROGRAM.app/Contents/MacOS/PROGRAM_BINARY
exit 0


and made it a policy available in Self-Service. This works, in that the program does the needful even if the user has a Standard account, however, the Terminal app launches as well, and does not go away after the software is done doing what it needs to do.



Is there a way to use the "open" command in a way that doesn't open Terminal? Or another way to execute an application as local admin?



Thanks,



-Mike

Have you tried entering the command in the "Files and Processes" -> Execute Command section instead of deploying a script?



We are doing this exact thing for a program called Provar that needs to run as admin once to enable git integration.


Yep, I tried it now, and it still launches Terminal like before. The interesting thing I noticed too, is that if I close Terminal, it terminates the software app since it seems to "own" the process.



-Mike


Have you tried just opening it at the app bundle level instead of the executable? I think the reason for the Terminal launching is because you're calling the executable inside the MacOS folder. Try just opening the app, meaning



sudo -u localadmin open /Applications/Utilities/PROGRAM.app


And you probably also don't need the sudo there since it will be running as root by default when run from a jamf policy.


@mm2270 Thanks, that worked!