Unlock Energy Saver Prefs for Non-Admins

jared_f
Valued Contributor

Does anybody know a script to unlock Energy Saver prefs for non-admins?

Thanks,
Jared

11 REPLIES 11

mark_mahabir
Valued Contributor

Have a look here.

jared_f
Valued Contributor

So I tried that command and it did not work. Tried this and same result. Does anybody have anything successfully working?

#!/bin/bash
# Allows non-admin users to change energy saver settings. User needs to be in static user group "Allow Energy Saver Changes"

/usr/bin/security authorizationdb read system.preferences.energysaver > /tmp/system.preferences.printing.plist

/usr/bin/defaults write /tmp/system.preferences.energysaver.plist group everyone

/usr/bin/security authorizationdb write system.preferences.energysaver < /tmp/system.preferences.energysaver.plist


exit 0;

rlandgraf
Contributor

This should unlock it the current logged in user.

#!/bin/bash

security authorizationdb write system.preferences.sharing allow

Taboc741
New Contributor III

@rlandgraf That one-liner doesn't for for me. neither does

#!/bin/bash
security authorizationdb write system.preferences.energysaver allow

any other suggestions?

Sandy
Valued Contributor II

Unlocking Energy Saver Settings for Standard User
Also have been trying many things with no success for Catalina

jimmy-swings
Contributor II

You need to allow access to "system.preferences" prior to "system.preferences.energysaver".

#!/bin/sh
# unlock the sysprefs before unlocking specific panes: 
security authorizationdb write system.preferences allow 

# unlock energysaver: 
security authorizationdb write system.preferences.energysaver allow

Tried this script and works like a charm. This will allow non-admin users to manage the Energy settings.

el2493
Contributor III

@jaz I know you were trying to get this to work for the Security pane here back in 2018. Were you able to get it working? I run the command to allow system.preferences and then to allow system.preferences.security. If I use security authorizationdb read for both then I see allow, but if I open to the Security and Privacy pane and try to unlock it with a non-admin user/password, it just bounces.

josh_miller
New Contributor II

Hello there,

I have a script I use that unlocks Date & Time, Energy Saver, Time Machine and Network as well as enables Location Services and Automatic Date & Time and Automatic Time Zone. You can check it out here:

https://github.com/joshua-d-miller/admin-scripts/blob/master/DEP Enrollment/Enrollment.py

It accounts for jamf so the first three variables are empty. Variable 4 can be used to run everything and variable 5 can be used to run individual scripts. For you you can run it with variable 5 set to "sysprefs" which should take care of it. Please give a try and let me know.

Thanks!

MasterNovice
Contributor

Does anyone have a resource on how Energy Saver management has changed in Big Sur (as Battery)? Our users are Standard non-admin, and we have been employing the security authorizationdb write option to work around allowing them access to various system preferences. In Big Sur this seems to have changed, but I'm unsure if it's that it just can't be managed the same way, the preference name has changed, or something else is affecting the setting. FOr our enrolled and supervised devices, even administrator users cannot modify the Battery pane and get a "Your administrator has not give you access to this pane" display.

vantive
New Contributor III

#!/bin/sh
# unlock the sysprefs before unlocking specific panes:
security authorizationdb write system.preferences allow

# unlock network setting:
security authorizationdb write system.preferences.battery allow