Someone pointed out to me that I wasn't clear on what I'm trying to accomplish.
Fair enough :)
At the request of someone who maintains a mobile lab of MacBooks, I am trying to
put together a script that will remove any saved keychain and 802.1x passwords
for JMU-Official-Wireless, remove any of our other SSIDs from the preferred
networks list, preferably make sure JMU-Official-Wireless is a preferred
network, and finally turn the AirPort card off and back on to activate the new
settings. With JMU-Official-Wireless being the only preferred network of the
ones we broadcast, when the card turns back on and scans for networks, it should
attempt to join that one and prompt the user for their login. To do all of that
in Snow Leopard is a handful of shell commands. Leopard, however, is proving
much more difficult in certain aspects.
Ideally, this script would run as a login item the mobile lab situation. I'm not
sure a LaunchAgent (although it'd be able to do things as root) would work since
there'd be no access to the user's keychain while the machine's booting. Also, I
suppose there's the possibility of this becoming a troubleshooting tool one day
so users being able to run it would be important.
Hope that helps.
Wes Davis wrote:
> Wondering if anyone knows any voodoo for managing or at least removing preferred
> wireless networks via command-line or AppleScript in Leopard? The 'networksetup'
> utility in Snow Leopard is more robust than Leopard's, making this sort of thing
> trivial, but I can't find a good method in Leopard. Oh, yeah, and without
> elevating privileges, preferably.
> Things I've looked at:
> - As mentioned above, it's limited on Leopard to getting/setting the AirPort
> card's power state, getting the name of the current network, and joining a
> network provided that it's open or simply needs a password. That doesn't really
> work with WPA Enterprise/8021.x network.
> - Will also associate to a network that's only password protected, but can
> disassociate from a network while leaving the card powered up as well.
> - Lets you talk to 'configd' and monkey (indirectly) with what I assume are
> plist files somewhere and I can get to the AirPort settings
> (Setup:/Network/Interface/en1/AirPort) but get a permission denied error when I
> try to write my changes (deleting the PreferredNetworks key).
> - Stores information on previously joined ("known") networks but I can't find a
> correlation between that and the current user's preferred networks. Not writable
> as regular user anyway.
> UI scripting via AppleScript
> - An obscenely messy way to accomplish what I want to do and annoying since
> it's not enabled by default (assistive devices). Makes me think that the System
> Preferences application runs with slightly-higher privs than the actual user
> (even for things that aren't locked by default) since it can do things like
> change preferred networks and enable/disable UI scripting. Both of these actions
> seem to require escalation/sudo if done via Terminal or AppleScript.
> Any input would be appreciated, even to tell me to take this to the Unix User's
> list :)
James Madison University
Massanutten Hall Room 157, MSC 5735
Harrisonburg, VA 22807
[log in to unmask]