Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

So in the spirit of this question I was wondering if it is possible to disable automatic 802.1X connection via terminal as well. Am I right to assume that this is a computer setting (meaning that if I run this script with no user logged in it still disables it for all existing and future users)?

share|improve this question

3 Answers 3

It took me some hours to learn that it's a boolean value (and not just 0 or 1 as 'defaults' would report) but finally i came up with the following LoginHook which does the trick. As LoginHooks get executed as root user, you have to 'su' to the user currently being logged in before running the script below. As Michele points out below, that username is available as $1 to the Hook-Script running as root. It seems to be a user byHost-Setting, although SystemPrefs would ask for a admin password to tweak this setting... My hook script being executed in user-context looks like this:

#!/bin/sh

if [ `whoami` = "root" ]; then
  echo "$0: Must run as regular user, not root! QUIT."
  exit 1
fi

# write new setting 
defaults write -currentHost com.apple.network.eapolcontrol EthernetAutoConnect -bool false

Using opensnoop(1) or fs_usage(1) I could not see any other files being modified. Hope it helps.

share|improve this answer

Just disable the Enable automatic connection tickbox in the 802.1x tab of your advanced interface option as it is the equivalent of the terminal command.

share|improve this answer

I don't know how this solution can work, since a LoginHook is executed as root and not as the user itself.

Here my solution:

#! /bin/sh
su - $1 -c "defaults -currentHost write com.apple.network.eapolcontrol EthernetAutoConnect -bool false";

Note that the option -currentHost will do the stuff with the host uuid ;-)

Cheers, Michele

share|improve this answer
    
Does this work, the first clause confuses me, also what do you pass in as a parameter to the script? –  Mark Apr 9 '13 at 11:38
    
The parameter $1 ist the username, which is automatically passed to this script by the LoginHook. –  Michele Marcionelli Apr 9 '13 at 11:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.