0

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.

2
  • Update. When changing the services through the GUI the plist files changes as expected, however when modifying via terminal a preferences.plist.old file is created in /Library/Preferences/SystemConfiguration/ .However, deleting this file or using it to replace the preferences.plist file still doesn't give the intended result.
    – Auspexis
    Feb 24, 2021 at 11:14
  • Tried to chown the preferences.plist and added an exit statement to the script to avoid any loose ends and still no change. Maybe I need to lock the plist with a lockfile?
    – Auspexis
    Feb 24, 2021 at 12:22

1 Answer 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .