How To

How to use Wireless/WiFi at your local Public Library with Linux (Debian/Ubuntu)

Ever been to one of the Public Libraries with a linux laptop, hoping to get on the internet using their FREE wireless internet? Well, if you have, you might have found out quickly that it does not work. In my opinion, I blame the outdated software that they are using on the library servers to provide the wireless service. Regardless, if you want to use their free wireless connection with a linux OS, you will need to do a few things to get it to work.

I have only tested this on Debian (so it will work with Ubuntu as well), but theoretically it should work on other flavors of linux too. Basically, when you connect to the wireless connection at a Public Library location, you have to authenticate yourself using a browser. The authentication is simply done by simply agreeing to the terms of service displayed on the browser, and clicking “Accept”. The only page served for unauthenticated machines is “spyders.local”, which is what displays the terms of service page. As you might be able to tell, whoever named that hostname was a geek too. Spyders?? Right! On a linux system, you will get a 404, page not found instead of seeing the terms of service. From what I have read, the problem seems to be caused by the fact that Public Library servers are all NT based. Therefore, the clients need to have WINS enabled to access the sypders.local hostname.

I know of two ways to get wireless internet working:

METHOD #1 (Easy/Quick/Clean/Temporary):

Before you do anything, connect to the Public Library wifi network from your network manager, or whatever tool you use to connect to wireless networks.

Next, if you have a Virtual Machine with Windows installed on it, then all you need to do is power up the VM and open a browser inside it. Try connecting to a site from the VM, and the spyders.local will show up. Once it does, you can accept the agreement and continue. Your host machine will also get authenticated this way, so you can even shutdown the VM after you do this step.

Of course, I am assuming that you have properly configured a virtual network card on the VM. I have a bridged network on the VM that I tested this procedure, running Windows XP. If you don’t have a VM or don’t want one, then you can try the other method. Keep in mind that you will have to authenticate after every reboot, logout, or after every network reset with this technique. Method #2 will give you a more practical and permanent solution.

Note: Although I have not tested this with WINE, that method should also work. For example, if you install FireFox for windows using WINE on your Linux system, it might do the trick. If anyone has tried this, feel free to post a comment. I may try it the next time that I am at the library and update this post.

METHOD #2 (Practical/Permanent/Must have Admin Privileges)

For this technique, you will need administrative privileges on the system. In most distributions, you can simply use the “sudo” command as long as you have been given that right by the administrator (i.e. on the sudoers list /etc/sudoers). If you installed the OS yourself, it is likely that you already have this. Otherwise, open up a terminal window and type su root. Then enter the password of the administrator account. If you don’t have administrative rights on the system, method #1 would be your best bet for now.

  1. Install winbind and samba packages. If you are using Debian, then type the following in the terminal:
    1. If root:
      apt-get-install winbind samba
    2. If regular user:
      sudo apt-get install winbind samba 

      Note: You need to be connected to the Internet already for this to work. So you might want to go somewhere that you can get online first, then run this command and come back to the library when it is done.

  2. Backup /etc/nsswitch.conf. In the terminal, type:
    1. If root:
      cp /etc/nsswitch.conf /etc/nsswitch.conf.backup
    2. If regular user:
      sudo cp /etc/nsswitch.conf /etc/nsswitch.conf.backup 
  3. Open the file named: /etc/nsswitch.conf.I use the nano command line text editor, but you can use anything you like. For example: vi, gedit, leafpad, etc… So type the following in the terminal:
    1. If root:
      nano /etc/nsswitch.conf
    2. If regular user:
      sudo nano /etc/nsswitch.conf 
  4. Find the line that starts with “hosts”. There should be only one such line normally. Often its “hosts files dns“. Simply add the word “wins” to the end of the line and save the file, making it “hosts files dns wins“.

     hosts files dns wins

    On Ubuntu systems, it would be something like hosts files mdns4_minimal [NOTFOUND=return] dns mdns4“. On ubuntu, I would simply comment out that whole line, and add a new line right below it that says “hosts files dns wins“. To comment out the existing value, simply add a hash symbol (aka pound symbol “#”) at the very beginning of the line, making it “#hosts files mdns4_minimal [NOTFOUND=return] dns mdns4“. If you do not wish to comment it out, but prefer to simply add “wins” to the existing line, you may have to play with the exact place where you put that word. It can’t be added to at the end, as that will not work. Putting it right after “dns” might do the trick. I have not bothered trying it, but please do let me know if it works for you.

    #hosts files mdns4_minimal [NOTFOUND=return] dns mdns4
    hosts files dns wins 


  5. Reboot your system. Just restarting the network may work also. After that, simply open your browser and you should see the Public Library agreement page. If you accept the agreement, you should have internet access now.

And there you go. How to access the Internet using linux at a Public Library. The process is quite simple, although I have made the explanation quite long to accommodate those who are still learning with additional hints. Of course, I make no gurarantees that this will work for you, but it should. Please be careful when you do things as the root user, or using the sudo command. Mistakes can render your system useless and destroy your valuable data. If you break something within the nsswitch.conf file, be sure to restore it using backup file. You can do so by deleting the existing file by typing “rm /etc/nsswitch.conf” and then typing “cp /etc/nsswitch.conf.backup /etc/nsswitch.conf”.

Now, go and enjoy your free wifi access!

[keyword id=’tech’]

What do you want to say?