Fixing Portable WiFi Hotspot (Tethering) after Android Lollipop Upgrade (Sony Xperia Z2, UK Three)

I managed to get a great deal with Three UK with unlimited data for £12.90 and added 1GB of personal wifi hotspot allowance for an additional £5.00 a month.

The hotspot allowance is great as it means I only need one SIM for all my devices when I am out and about.

It all worked fine until I upgraded my phone (a Sony Xperia Z2) to Android Lollipop (v5.0.2) at which point my hotspot stopped working. Devices could still connect to the phone, but showed DNS related errors when they tried to access the internet.

Contacting Three and Sony customer support did not solve the problem but eventually I found the solution at http://forum.xda-developers.com/z3/general/lollipop-tethering-t3058923 (hooray for XDA developers).

I reproduce the solution here:

  1. enable developer mode (Settings->About Phone, click several times on the build number until you see a message which says developer mode is activated)
  2. enable USB debugging (Settings->Developer Options->USB debugging)
  3. install the Android SDK on your computer to get the ADB executable and add it to your PATH
  4. connect the phone to the computer via USB
  5. open a command line/shell
  6. use the command line/shell to start an adb shell (adb shell)
  7. execute the following command in the shell:
    settings put global tether_dun_required 0

No root access is required and no reboot was required; the next time I started up the portable hotspot devices could access it with no problems at all.

The Raspberry Pi running the Windhill21 Code Club web server.

Setting up an Apache Web Server with per user Directories on Raspberry Pi

As part of the Code Club that I run at Windhill21 primary school we are currently learning how to develop web sites using HTML, CSS and a little JavaScript following the appropriate set of projects from the organisation.

I wanted to set up a web server that the children in the club could upload their creations too. Since the school has a number of Raspberry Pi’s, I thought it would be a cool idea to set one of them up to host a web server.

I wanted each of the children to have their own account on the Raspberry Pi that they could upload their files to and their own URL to access them from.

i.e. “johnny” would have an account they could log onto and then upload their files into the /home/johnny/public_html directory using FTP directly or a tool such as Microsoft WebMatrix and would then be able to access them at http://www.myservername.com/~johnny.

This proved to be quite time consuming so I wanted to present a step-by-step guide to how I achieved it.

Step-by-Step Guide

  1. Install Apache
    • sudo apt-get install apache2 -y
  2. Configure Apache to Use Per-User Directories
    • ln -s /etc/apache2/mods-available/userdir.conf /etc/apache2/mods-enabled/userdir.conf
    • ln -s /etc/apache2/mods-available/userdir.load /etc/apache2/mods-enabled/userdir.load
    • # reboot the server
      sudo apachectl restart
  3. Add Users (e.g. user bob) – you might want to write a script for this
    • # add the bob user
      sudo adduser bob (you will be asked to enter some basic information and a password for bob)
    • # make a directory to store web files in
      mkdir /home/bob/public_html
    • # add bob to the www-data group which Apache is part of
      sudo adduser bob www-data
    • # change the default ownership and permissions of public_html
      # set the ownership to user bob and group www-data
      sudo chown -R bob:www-data /home/bob/public_html
      # set the permissions to read-write for bob and read-only for www-data
      sudo chmod -R 750 /home/bob/public_html
    • # set new files to be owned by the www-data group
      sudo chmod g+s /home/bob/public_html

Now, if “bob” logs on to the Raspberry Pi and adds new files to /home/bob/public_html they will be created with the correct permissions to allow bob to edit them and for the Apache web server to read (and hence serve them).

Hopefully this may save someone else some time in the future.