[How To] WPA Supplicant

Recommended Posts


Okay so this is the first guide I've ever attempted so go easy on me. I've broke and had to reinstall ubuntu so many times now that I figured I'll just write this up here. This guide is aimed helping you through setting up wpa_supplicant for any of the drivers that it supports, which will allow you to access wpa encrypted wireless networks.

This is based on the many threads at ubuntuforums.org so thanks to the good people of the Ubuntu world.


(1) It will not guide you through installing the drivers for your wireless card so I assumed that you already have it installed and working on non encrypted networks

(2) I use Ubuntu (Debian) so some parts of the install may not apply to or work the same way your distro.

(3) I am a noob at this stuff so it may not be perfect.

(4) My brain works slower than everything else so tell me if some parts trail off into incoherent babbling.

Part 1 - Installing WPA_Supplicant:

Installing from repositories/packages

If you have a package manager like apt-get or yum you can install wpa_supplicant through that. It will make your life a whole lot easier.

a) Installing from apt repositories:

sudo apt-get update
sudo apt-get install wpasupplicant

b) Installing from a .deb file

dpkg -i wpa_supplicant.deb

c) Installing from yum

yum install wpasupplicant

Installing from source:

Download the latest stable WPA_Supplicant source from here.

Extract the tar.gz

tar -xvzf wpa_supplicant-0.3.9.tar.gz
cd wpa_supplicant-0.3.9

Now you need to set up the compile options.

cp defconfig .config
nano .config

This is using the example config file that is provided. You need to uncomment the CONFIG_DRIVER part that lists the driver you are using.


If you are using ndiswrapper, change this


To this


The rest of the options should be okay, don't mess with them unless you know what you are doing.

Save and exit.

sudo make install

Part 2 - Configuration:

nano /etc/default/wpasupplicant

Enable it by editing the file to:


Save and exit

Editing the config file:

sudo chmod 600 /etc/wpa_supplicant.conf
sudo nano /etc/wpa_supplicant.conf

If you compiled from source then you need add the following to the config file. If not then skip to the 'Setup ssid and WPA key' part.


Setup the ssid and WPA key.

In the terminal type:

wpa_passphrase <ssid> <wpapassphrase>

This should give you something like:






Now copy that and you will need to paste it into your config file.

Also add this after the "psk=" part:


So the final section of the config should look like similar to this:


Now save and exit.

Part 3 - Running and automating it:

Now you can test if it is working.

sudo ifconfig wlan0 up


1) You may need to change the 'ndiswrapper' part to the name of the driver you are using.

2) You may also need to change 'wlan0' to the name for your wireless device. It may be 'ath0' for madwifi drivers or eth0 in some cases.

3) the -B switch runs this in the background. If you are having problems then you can view the debug output by removing the -B part and adding -dd to the end of this command.

sudo wpa_supplicant -Bw -Dndiswrapper -iwlan0 -c/etc/wpa_supplicant.conf
sudo dhclient wlan0

Now it should connect..

Automating it at startup

sudo nano /etc/network/interfaces

Add this:

(Again, you may need to change wlan0 and ndiswrapper to your device and driver name if it is different)

auto wlan0
iface wlan0 inet dhcp
pre-up /usr/sbin/wpa_supplicant -Bw -Dndiswrapper -iwlan0 -c/etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant

Now it should run at boot time.

Edited by Rob2687
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.