Question

I have written a shell script to remove all services excluding ethernet. The aim is to remove these services and PPPoE entries so the end user only sees ethernet under Preferences > Networking.

However, after a restart the services return. This also happens with just running the terminal command networksetup deletepppoeservice [servicename]

I presume there is a plist somewhere that repopulates these entries, however I have deleted networkInterfaces.plist to no effect.

Here is the code snippet in question:

SERVICE="Ethernet"
for NETSERV in ${networkService[@]}; do
    if [[ "$NETSERV" != "$SERVICE" ]]; then
        networksetup deletepppoeservice "$NETSERV";
    fi
doneSERVICE="Ethernet"
for NETSERV in ${networkService[@]}; do
    if [[ "$NETSERV" != "$SERVICE" ]]; then
        networksetup deletepppoeservice "$NETSERV";
    fi
done

The goal: enter image description here

Thanks.

Was it helpful?

Solution

So the solution that I stumbled on was to lock the file using chflags uchg /Library/Preferences/SystemConfiguration/preferences.plist so whatever was modifying it back was denied. Oddly, it was a root owned file so whatever was modding it was root.

I ran sudo fs_usage | grep /Library/Preferences/SystemConfiguration/preferences.plist and saw no write or modify commands so it had to happen on boot or login.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top