Add eduroam (or any other 802.1x) wireless network to Ubuntu Phone

I’m currently running Ubuntu Touch on a Nexus 4, unfortunately at present, there is no way to connect to 802.1x secured networks through the GUI. It is, however, possible to do this through the terminal.

Start by enabling developer mode on the Ubuntu handset, go to System Settings/About this phone/Developer mode and enable the “Developer Mode” tickbox. You will need to set a passcode/passphrase to do this. The code/phrase you set will be the password for the phablet user once we get a shell on the phone.

Now connect your phone to an Ubuntu laptop/desktop and then run the following in a terminal:

sudo apt-get install android-tools-adb
adb shell
cd /tmp

So at this point, we’ve opened a shell on the phone and changed to the /tmp directory. Due to the write-protected nature of the phone’s file system, we now have to create a network config file by piping its contents into place. Simply using nano or any other editor here won’t allow you to save your changes.

As you’ll need to modify this line for your own 802.1x network, it can be a little cumbersome, but the key fields are id (currently set to eduroam), identity (the username you’ll use, drb502@york.ac.uk here) and then password (shown here as YourPasswordHere). Modify these fields accordingly and ensure that the file you’re piping to is called the ssid of the network, so here eduroam.

printf "[connection]\nid=eduroam\nuuid=f789bb72-99e9-43ba-a5e4-68b2b53d6e98\ntype=802-11-wireless\n\n[802-11-wireless]\nssid=eduroam\nmode=infrastructure\nsecurity=802-11-wireless-security\n\n[802-11-wireless-security]\nkey-mgmt=wpa-eap\n\n[ipv4]\nmethod=auto\n\n[ipv6]\nmethod=auto\n\n[802-1x]\neap=peap;\nidentity=drb502@york.ac.uk\nphase2-auth=mschapv2\npassword=YourPasswordHere\n" > eduroam

You can check for obvious errors by typing “cat eduroam” to show the contents of the new file and how it’s formatted. If you need to change anything you’ll have to printf the entire string to the file again, overwriting what’s there already. Now we move this file to the appropriate directory for Ubuntu to be able to use it:

sudo mv /tmp/eduroam /etc/NetworkManager/system-connections/

The password for phablet is the pin/security phrase you set earlier.

And then set the correct permissions for it, this is very important else it will be ignored:

sudo chmod 600 /etc/NetworkManager/system-connections/eduroam

That’s it… if it hasn’t connected straight away, turn wifi off and back on or try selecting the network’s ssid from the list and it should just connect.