Posted on 01-18-2012 06:10 AM
We are rolling out 60+ rented laptops for a software update to iOS devices... each machine will have a factory default image on it from apple. My job is to tweak each system to disable AirPort / Enthernet, set an auto-login, and put a disclaimer on the system. I found in the JamfNation archives a script to disable the AP, but nothing (incl google) on how to disable the EN0.
What would be the easiest way to do that? Since it will probably be another group that touches the machines, i'd like to bundle the changes up into as few packages as possible. I have a DMG of the disclaimer that we are using for lion and the script for the airport disable... but nothing for the remaining requirements...
Any suggestions (keeping in mind my scripting knowledge is right around nil.)
Posted on 01-18-2012 06:44 AM
/Library/Preferences/SystemConfiguration/preferences.plist
You can set en0 to be disabled here.
Use fseventer.app (free download) to see the before and after states when you toggle in system prefs
Posted on 01-18-2012 08:51 AM
something like this can do the trick
networksetup -setnetworkserviceenabled Airport off
Do, note in Lion Airport is replaced with Wi-Fi so it would be like this for Lion
networksetup -setnetworkserviceenabled Wi-Fi off
As long as they don't have admin they shouldn't be able to re-enable it. You may have to use the MCX/Profile setting to require admin to change airport settings as well
Posted on 01-18-2012 11:36 AM
The linked script could be edited to do what you need:
http://macmule.com/2011/09/09/how-to-turn-off-wireless-card/#more-315
It's mainly taken from the turn airport of script in the resource kit.
Posted on 01-18-2012 11:46 AM
Sorry hit post response mid thought... This might disable all network services.... Maybe what you want...
It's taken from the above linked script.
TEST TEST TEST
#!/bin/sh
#Loops through the list of network services
for i in $(networksetup -listallnetworkservices | tail +2 | cut -c 2-);
do
#Disables netwoprk services
/usr/sbin/networksetup -setnetworkserviceenabled "$disabledServices" off
echo "disabled $1..."
done
Posted on 01-18-2012 11:53 AM
Yeah you can skip OS detection just by creating an array of enabled services.
networksetup -listallnetworkservices | grep -v "*"
Pretty much just like Ben posted above. Hope this helps!
-Tom
Posted on 01-23-2012 09:10 AM
Ben,
When I try yours it returns a bunch of
is not a recognized network service. ** Error: The parameters were not valid. disabled ... is not a recognized network service. ** Error: The parameters were not valid. disabled ... is not a recognized network service.
So I changed the link to when TLarkin put, and it lists the available connections (Ethernet, BlueTooth, Wi-Fi, etc) then bombs out with
/Users/jwojda/Desktop/disableNetwork.sh: line 5: syntax error near unexpected token `do' /Users/jwojda/Desktop/disableNetwork.sh: line 5: `do'
Posted on 01-23-2012 10:53 AM
can you post the whole script, I could help you with it
-tom
Posted on 01-23-2012 11:23 AM
You guys are my hero's!
#!/bin/sh
#Loops through the list of network services
networksetup -listallnetworkservices | grep -v "*";
do
#Disables network services
/usr/sbin/networksetup -setnetworkserviceenabled "$disabledServices" off
echo "disabled $1..."
done
Posted on 01-23-2012 11:27 AM
OK, so what services do you want disabled, all of them or just Airport, Wi-Fi?
So, for example if you wanted to disable all network services across the board, modify the script to this:
#!/bin/sh
#Loops through the list of network services
netService=$(networksetup -listallnetworkservices | grep -v "*")
#Disables network services
for service in ${netServices} ; do
/usr/sbin/networksetup -setnetworkserviceenabled ${service} off
echo "disabled ${service}..."
done
exit 0
Posted on 01-23-2012 11:44 AM
All is fine - the less connectivity the better - according to security. I ran the script and theres no output - and the connections remain active.
though the syntax looks correct...
Posted on 01-23-2012 12:31 PM
well the command works manually with the Ethernet card, I think you may have to set the power on the AirPort/Wi-Fi with the -setairportpower setting.
I am testing this on 10.6.8 by the way