Connect wpa-encrypted AP using scripts in linux

Source: Internet
Author: User
In linux, use a script to connect to the wpa-encrypted AP-general Linux technology-Linux technology and application information. The following is a detailed description. In linux, wpa_supplicant needs to be installed to connect wpa encrypted AP using scripts (FEDORA12 has been installed by default)
Create the wpa_A.conf file with the following content:
Ctrl_interface =/var/run/wpa_supplicant
Ctrl_interface_group = wheel
Ap_scan = 1
Network = {
Ssid = "apssid"
Psk = "key"
}

Create a connection shell script with the following content:
#! /Bin/bash
Initctl stop wpasupplicant # different versions may be different. Some versions do not need to do this step.
Ifconfig wlan0 up
Wpa_supplicant-iwlan0-c/path/of/conf/file/wpa_A.conf &
Sleep 5
Dhclient wlan0

Appendix:
Connect to wep encrypted AP shell
#! /Bin/bash
Iwconfig wlan0 key s: password
Iwconfig wlan0 key open
Iwconfig wlan0 essid ssidname
Ifconfig wlan0 up
Dhclient wlan0

Connect to unencrypted AP
#! /Bin/bash
Iwconfig wlan0 essid ssidname
Ifconfig wlan0 up
Dhclient wlan0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.