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.

Ubuntu 12.04 Ultimate Server Guide

This guide will help you configure Ubuntu Server Edition 12.04 for a small/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network. This will be one unified setup, supporting Ubuntu, Windows and OS X clients… let the fun begin! Continue reading Ubuntu 12.04 Ultimate Server Guide

How to Build an Ubuntu 11.10 SBS (Small Business Server)

This guide will help you configure Ubuntu Server Edition 11.10 for a small/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network.
Continue reading How to Build an Ubuntu 11.10 SBS (Small Business Server)

Make Windows the Default Operating System in Grub2… even after Ubuntu updates…

Many guides for changing the default operating system for Grub2 to boot involve setting the number indicating where in the list that OS appears… unfortunately, when kernel updates are released for Ubuntu they shift everything down two places and your default OS therefore changes.

Continue reading Make Windows the Default Operating System in Grub2… even after Ubuntu updates…

How To Generate An SSH Keypair To Allow Password-less Logins

It’s quite common to use SSH/SCP in scripts, particularly for backup purposes. Unfortunately, this would mean storing a password in the script, which would consequently appear in logs etc… A much better plan is to use SSH keypairs. Once you’ve created a passphrase-less keypair and copied it to both machines, you can login without a password.

Firstly we’ll create the key on the client machine. This is the machine that you want to be able to connect FROM without using a password. In this scenario, the machine “www” is going to run a backup script that needs to store data on “neo” without using a password. So we create the key on “www”.

ssh-keygen -t rsa -b 4096

The -b 4096 is optional, but will instruct the machine to generate a more secure 4096bit key rather than the default 2048 bit one.

When asked for a passphrase, simply hit enter for none.

Now we need to copy the key to the machine that we want to be able to access without a password:

ssh-copy-id -i ~/.ssh/id_rsa.pub dan@neo.danbishop.org

You will be prompted for your password for the user dan@neo.danbishop.org.

All done 🙂

You can now type “ssh neo” and it will log you straight in without asking for your password! 😀

ASUS Upside Down Webcam in Ubuntu?

If you notice your webcam is upside down on skype/flash but fine on everything else, there’s a good chance the following will solve your problem.

Simply run this command in a terminal, followed by the program you want to run. For example for skype:

export LD_PRELOAD=/usr/lib32/libv4l/v4l1-compat.so
skype

Or

export LD_PRELOAD=/usr/lib32/libv4l/v4l1-compat.so
chromium-browser

Note that the path contains lib32 as both flash and skype are 32bit programs. If you’re actually using a 32bit version of Ubuntu you can modify the path to read: /usr/lib/libv4l/v4l1-compat.so

Update: Name change for 11.04+

If you’re using Ubuntu 11.04 (Natty) or above you need to use the following instead:

export LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so
skype

Or

export LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so
chromium-browser

Create Your Own Local Mirror of the Ubuntu Repositories

If you have several Ubuntu machines on a network, you might like to mirror the Ubuntu repositories locally so that you’re not wasting bandwidth downloading the same packages from the internet for every single machine. If you’ve already got an Ubuntu server up and running for some other task (such as ldap+kerberos+nfs type server, or a local web server) it’s very easy to add mirroring repository functionality to it. All you need is a spare ten minutes and ~35GB of free space for main, universe and multiverse and ~70GB if you also want the source packages (deb-src). Continue reading Create Your Own Local Mirror of the Ubuntu Repositories