Forget WiFi network without admin credentials

Is there a way to forget a WiFi network on MacOS without knowing the admin credentials?


From within macOS, no you can't.

If you don't unlock System Preferences you can't add or delete a Wi-Fi access point.

As you can see you can't select a Preferred Network and the +/- is locked.

Network Preferences

Neither can you do it from command line.

You can add a network with sudo networksetup -addpreferredwirelessnetworkatindex en0 whateverNetwork 0 WPA2 whateverPassword but if you try to delete it without sudo - for example with networksetup -removepreferredwirelessnetwork en0 whateverNetwork then it will prompt you.

Terminal

The reason is that the files updated are these - they are owned by root and can not be modified by a non-admin user. :

A1398% ls -la /Library/Preferences/SystemConfiguration/*preferences*
-rw-r--r--  1 root  wheel   9323 Jan 15 15:42 /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
-rw-r--r--  1 root  wheel   6891 Dec 27 13:35 /Library/Preferences/SystemConfiguration/preferences.plist
-rw-r--r--  1 root  admin   6891 Jan 15 15:42 /Library/Preferences/SystemConfiguration/preferences.plist.old

Also note as an aside that the data that is changed when you add/remove a preferred network is encrypted.

For example com.apple.airport.preferences.plist was updated with wifi.ssid.77686174657665724e6574776f726b when adding and removing access point called whateverNetwork.

This means that if you booted from external OS to edit these files you would have to guess which keys to delete although in my limited testing they do appear to be in the same order as shown in System Preferences.