MacOS – Limit wifi network access per-user with user switching

keychainmacosNetworkwifi

I have a machine running Mavericks shared between two users. One user "Foo" should have access to a network, "Private network A" and another user "Bar" should not. Both users may access "Trusted network B".

I have removed the stored password for "Private network A" from the system keychain and moved it to "Foo"'s keychain.

However, when "Foo" switches to "Bar" using user switching, the connection to "Private network A" is maintained. Is there a way to force the network to disconnect on user switch?

Edit: This happens if user Foo logs out first and then user Bar logs in.

Best Answer

You may be able to disconnect and reconnect using an AppleScript firing a shell command such as this: http://hints.macworld.com/article.php?story=20031206194417678