參考文檔
網(wǎng)絡(luò)相關(guān)
Wi-Fi
networksetup -setairportnetwork en0 WIFI_SSID WIFI_PASSWORD
# Create a symbolic link to the airport command for easy access:
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport
airport -s
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'
# 或者
wifiNetwork=$(/usr/sbin/networksetup -getairportnetwork "$wifiDevice" | /usr/bin/cut -d":" -f2 | /usr/bin/cut -d" " -f2)
# 貌似沒(méi)有打印LastConnected
defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences | grep LastConnected -A 7
networksetup -setairportpower "$wifiDevice" on
/usr/sbin/networksetup -getairportpower "$wifiDevice" | /usr/bin/cut -d" " -f4
- 禁用所有用戶(hù)有線(xiàn)接口自動(dòng)802.1x連接(未測(cè)試)
sudo logger "802.1x Setup: Automatic 802.1x connection on wired interfaces for all existing users disabled."
IFS=$'\n'
for i in $(dscl . -list /Users PrimaryGroupID | grep ' 20$'| cut -d' ' -f1)
do
sudo -- su - $i -c 'defaults -currentHost write com.apple.network.eapolcontrol EthernetAutoConnect -bool FALSE'
done