nonadmin Wi-Fi

kenergy
Contributor

If you block users from being local admin this script will enable it for non local admins.

#!/bin/sh

# Get "Wi-Fi" or "Airport" based on your OS
wservice=`/usr/sbin/networksetup -listallnetworkservices | grep -Ei '(Wi-Fi|AirPort)'`

# Get port
whwport=`/usr/sbin/networksetup -listallhardwareports | awk "/$wservice/,/Ethernet Address/" | awk 'NR==2' | cut -d " " -f 2`

# Set preferences
/usr/libexec/airportd "$whwport" prefs DisconnectOnLogout=Yes JoinMode=Automatic JoinModeFallback=DoNothing RememberRecentNetworks=No RequireAdminIBSS=No RequireAdminNetworkChange=No RequireAdminPowerToggle=No

exit 0
1 REPLY 1

davidacland
Honored Contributor II

Thanks Ken. This helps with another project I'm working on at the moment.