1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #! /bin/sh # SSID (aka. network name). SSID='Tenda' # Network encryption method. # * 'WPA' for WPA-PSK/WPA2-PSK (note: most Wi-Fi networks use WPA); # * 'WEP' for WEP; # * 'Open' for open network (aka. no password). ENCRYPTION='WPA' # Network password. (WPA-PSK/WPA2-PSK password, or WEP key) PASSWORD='pass' if [ $(id -u) -ne 0 ]; then printf "This script must be run as root. \n" exit 1 fi NETID=$(wpa_cli add_network | tail -n 1) wpa_cli set_network $NETID ssid \"$SSID\" case $ENCRYPTION in 'WPA') wpa_cli set_network $NETID key_mgmt WPA-PSK wpa_cli set_network $NETID psk \"$PASSWORD\" ;; 'WEP') wpa_cli set_network $NETID wep_key0 $PASSWORD wpa_cli set_network $NETID wep_key1 $PASSWORD wpa_cli set_network $NETID wep_key2 $PASSWORD wpa_cli set_network $NETID wep_key3 $PASSWORD ;; *) ;; esac wpa_cli enable_network $NETID wpa_cli save_config |
1 2 3 4 | # needed for wpa_gui to work ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev # needed to allow wpa_gui to alter the configuration update_config=1 |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |