Sunday, October 10, 2010

Ubuntu Wireless Connection from Command Line (WPA-PSK)

It can be useful to make a connection from the command line, without having to use the network manager. This is the magic incantation:

$ sudo ifconfig wlan0 down && sudo dhclient -r wlan0 && sudo wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -dd & sudo dhclient wlan0

And the file /etc/wpa_supplicant.conf should contain:

ap_scan=1
ctrl_interface=/var/run/wpa_supplicant

network={
        ssid="YOUR_NETWORK_NAME_HERE"
        scan_ssid=0
        proto=WPA
        key_mgmt=WPA-PSK
        psk="PASSWORD"
        pairwise=TKIP
        group=TKIP
}

No comments:

Post a Comment