Mac – Enable sudoing for the logged-in user for one specific prefpane only

macmojavesudo

We are running OS X 10.14 VMs hosted on VMWare ESX.
Users log into the VMs via Screensharing app.
VMWare sets the resolution settings to an odd value, so the users would have to use a VMWare command line tool to change the setting to their needs.
Since most users are not capable of using the command line, I installed a PrefPane on the VMs: 
VMware.prefPane. Works pretty good.
In order to set the resolution setting boot-persistent, you need to enter an admin pw, which no user is allowed to.
So I would like to change the sudoers file as follows:
Allow sudo for

  • a specified account or the logged-in user
  • only for the purpose of changing resolution values via the VMware.prefPane.

Can someone give me a hint on this …?

Best Answer

You have to script a task to run from the command line for sudo to grant password-less admin rights. It only works on shell scripts and not the GUI password prompt.

The first way to help you is to clarify you have two problems.

  1. Make a terminal command into an app that can be clicked so you don’t have to train people in terminal app. (A very valid and worthwhile exercise to solve a general class of problems)
  2. Make a command line tool that does what you need - which solves your specific vmware control issue or blockage.

Once you have solved both of these sub tasks, you may or may not need a third question on how to combine two working parts together.