Setup wpa_gui and roaming on Debian

Until recently I was editing my /etc/network/interfaces file each time I wanted to change my wifi connexion parameters:

iface wlan0 inet dhcp
    wpa-ssid somewhere
    wpa-key-mgmt WPA-PSK
    wpa-psk "secret"
    wpa-proto WPA
    wpa-pairwise TKIP
    wpa-group TKIP

I’m now using wpa_gui which is part from wpasupplicant. To install wpa_gui just do:

apt-get install wpagui

My /etc/network/interfaces file now only contains this 3 blocks:

auto wlan0
iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

The auto statment is required to automatically start the wpa_supplicant daemon at startup. The /etc/wpa_supplicant/wpa_supplicant.conf file should at least contains the 2 following lines:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

The update_config parameter let users add AP parameters from the GUI. GROUP=netdev let netdev group member control wpa_supplicant from wpa_cli or wpa_gui. Here is how to add a member to the netdev group:

adduser johndoe netdev

wpa_supplicant.conf will contains sensible data, like AP keys, so its access should be limited:

chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf

Finally I added wpa_gui in the session startup of XFCE. It’s in the Session and startup configuration GUI. KDE users would type ln -s /usr/sbin/wpa_gui in the .kde/Autostart directory.

References: /usr/share/doc/wpasupplicant/README.Debian.gz