<\/p>\n
First and foremost, you will need to have wpa-supplicant<\/strong> installed, otherwise it won’t work. Ubuntu does installs this be default, but to be on the safe side you can install the required package with this command:<\/p>\n
<\/p>\n
sudo apt-get install wpasupplicant<\/p>\n
<\/p><\/blockquote>\n
So far so good, next up we’ll be creating 2 files alongside eachother, the first being:<\/p>\n
wireless-wpa.sh<\/strong><\/p>\n
#!\/bin\/sh
\niface=wlan0<\/p>\n#shut down interface
\nifconfig $iface down<\/p>\n#set ad-hoc\/management of wireless device
\niwconfig $iface mode Managed<\/p>\n#enable interface
\nifconfig $iface up<\/p>\n#stop any persistent wireless wpa2 sessions
\nkillall wpa_supplicant<\/p>\n#apply WPA\/WPA2 personal settings to device
\nwpa_supplicant -B -Dwext -i $iface -c .\/wireless-wpa.conf -dd<\/p>\n#obtain an IP address
\ndhclient $iface<\/p><\/blockquote>\n<\/p>\n
Be extra sure to corrent the have the correct iface<\/strong> value in your script!<\/p>\n
Our second file would be:<\/p>\n
wireless-wpa.conf<\/strong><\/p>\n
# config file using WPA\/WPA2-PSK Personal key.<\/p>\n
ctrl_interface=\/var\/run\/wpa_supplicant<\/p>\n
network={
\nssid=”my_router_id”
\nscan_ssid=1
\nkey_mgmt=WPA-PSK
\npsk=”1234567890″
\n}<\/p><\/blockquote>\n<\/p>\n
Should you have absolutely no clue about the name of your Router’s or Access Point’s ESSID, issue this command to have the Wi-Fi card look around for available wireless networks (wlan0<\/strong> is the name of your wireless card as per ifconfig<\/strong>):<\/p>\n
<\/p>\n
sudo iwlist wlan0 scan<\/p>\n
<\/p><\/blockquote>\n
Now issue the following commands:<\/p>\n
<\/p>\n
sudo chmod 755\u00a0wireless-wpa.sh
\nsudo chmod 644 wireless-wpa.conf<\/p><\/blockquote>\n<\/p>\n
Finally,\u00a0now bring up the connection by running:<\/p>\n
<\/p>\n
sudo .\/wireless-wpa.sh<\/p><\/blockquote>\n
<\/p>\n
This is pretty useful if you do not wish to deal with \/etc\/network\/interfaces and soforth.<\/p>\n
The original guide can be found by clicking here<\/a>.<\/p>\n