Simple Linux DHCP / DNS Server

I’ve just completed the first DNS and DHCP server that I’ve built for a while. This was using Ubuntu Linux 8.04.

The nice thing about the process this time around as opposed to when I set one up a couple of years ago is that I was a little more au fait with the process. The DHCP successfully updated the DNS records, and everything ticked along nicely.

It’s going into production tomorrow, so I’m hopeful that it will fix a number of network problems that a client has been having with the RM DHCP Server service that runs in Windows XP.

If it would be easy to tie the upcoming Samba 4 into the mix, then I think that you have the perfect open source server! I have another server to put together soon, so I plan to write a ‘howto’ and post it here.

Mount a Webdav folder in Ubuntu Linux

Webdav is a very handy protocol for writing files back and forth across the internet.

I’ve never really had much call for it – but I’m all for it lately as I’m trying out Alfresco and would really love to see a better way to upload files than the basic web-bsaed uploader that is provided.

As Firefox doesn’t had webdav support, I’ve had a go at mounting webdav folders in Linux. The results have been good, with a couple of small caveats that are remedied fairly easily.

First of all, you need to install the davfs2 package. Once done, we can start connecting to a webdav folder on t’internet:

Open up the terminal and create the mount folder:

mkdir ~/webmount

Now run the mount.davfs command to connect as root

sudo mount.davfs ~/webmount -o rw,uid=john

Now, let me quickly explain the paramters. is the server and path
~/webdav is your local directory where you want to webdav files to appear
-o rw,uid=john is the options to set the webdav as re-writable and allow me (john) to have user-level access to the files. Make sure that you put your own username here.

And that’s it.

When you copy files, you might get an error such as this:

cp myfile.pdf ~/webmount/

cp: cannot create regular file `~/myfile.pdf': Input/output error

This is caused by the server not supporting file locks. You will need to edit the /etc/davfs2/davfs2.conf file and add the following line:

use_locks       0

Remount your webdav directory, and you should be able to create files with no problems.

No More Lost Deleted Files in Ubuntu

I had a shocking error of judgement this morning when I accidentally deleted some of my son’s photos from his toy digital camera. They were sitting on my desktop, and I was on a cleanup… These were a casualty of my cleanup-fest and obsession with the shift key.

Thinking on a Windows vein – I thought that I should be able to backup the files easily and seamlessly. But I don’t want too much aggravation. A quick scoot around the Ubuntu forums, and I found TimeVault.

TimeVault is the equivalent project to Windows’ Shadow Copy service or Apple’s Time Machine. Basically it’s a completely transparent backup that allows you to recover files easily on the system you are working on.

I’ve downloaded the .DEB and forced the installation (there’s no binary x64 version at the moment). I’ll see how it all goes and report back!

Move a print job from one queue to another in Linux

Today, I was looking at my printer queue and realised that Claire had tried to print something from the internet to my work printer. This meant that unless I went to the office – it would not print. A problem.

Because Claire had decided to use my laptop rather than one of the desktops, I was set up for Linux and believed that I could solve this problem someone in a very tekky way.

A quick squint at the internet found Linux Commando’s How to move print jobs from one printer queue to another.


So, to break it down – here’s what you do. Let’s say that you’ve printed to printer B, but you meant to print to printer A, this is what we do.

Step 1

Find the print job number in the queue. The easiest way is at the command prompt

<code>lpq -P printerB</code>

This will show a list of jobs:

printerB is ready and printing
Rank    Owner   Job     File(s)                         Total Size
active  john    180     12 Steps to a Success with Your 182272 bytes

Now we can see that your print job is 180. Great.

Step 2

So I want to move that job to printerA:

<code>sudo lpmove printerB-180 printerA</code>

That’s it. Now if you check the queue for printer A:

<code>lpq -P printerA</code>

You will see the print job printing out. Hurrah!

How to download BBC iPlayer programmes

I’ve found the BBC iPlayer client very frustrating to use. Even though the client is cross-platform thanks to Adobe Air – it’s slow and sometimes doesn’t allow you to download a programme when you should be able to.

Also, it doesn’t work properly on 64-bit platforms such as Ubuntu (which is what I use), so the process becomes even more difficult.

So, after getting quite fed up with iPlayer still not quite delivering – I had a scoot around the internet and found a very useful program which will download those videos very nicely.

get_iplayer boasts that it can download BBC TV, radio and ITV onto your computer. Not only this, but it can also be scheduled to download your favourite programmes just like a PVR. So it’s like Sky+ or TiVo, but better. But bear in mind the disclaimer:

Of course, to respect the content providers’ wishes and fair-use legislation, you should keep the recorded content for no longer than 30 days (in the UK), not attempt to obtain it from outside of the UK and not redistribute it. get_iplayer is not intended for use in making illegal copies of copyrighted content. Please respect the rights of the content owners when recording. get_iplayer will attempt to remove its recorded content which is more than 30 days old.

Getting Started
First thing’s first, we need to install it. I’ll assume that you’re using Ubuntu Linux for this, but you can install this on Linux, Mac or Windows.

First of all, download the get_iplayer package from the download page. You’ll also need the flvstreamer package to download the high quality videos.

Once downloaded and installed, you’ll be all set to start downloading. The first thing to do is get an up to date list of programmes. Running


On its own will refresh the BBC feed and list all the programmes curently available. There may be a lot so you might want to search by the title of the programme:

<code>get_iplayer "Top Gear"</code>

will list all of the BBC iPlayer programmes matching the phrase “Top Gear”

Now you decide that you want to download all of the “Top Gear” series, you can download them with:

<code>get_iplayer "Top Gear" --get</code>

This will download all the available episodes of Top Gear as a .mov file. Using additional parameters, you can also download in various formats such as HD .mp4 files.

Alternatively, if you’ve got the link to a program and you want to download it without any fuss – then you just need the URL or the ID of the programme to download it instantly:

<code>get_iplayer --get --pid</code>

This will download the radio show The Tao of Bergerac onto  your computer without the need for searching for the programme through the get_iplayer command line tools.

There is loads more you can do, such as using get_iplayer as a PVR. The documentation covers the different commands well, and is definitely worth having a squint through. Just remember to watch how much you’re downloading if you have capped bandwidth from you internet provider.

If you feel like something a bit more graphical, the is also a get_iplayer PVR Manager available to try.

Happy downloading!

SCP and filename spaces

An issue that pops up for me occasionally is that scp doesn’t much like copying filenames that contain spaces. When you use the scp command, even in quotes – the result is that scp treats each space as a separate file.

Thankfully, there is a way to easily fix this. You need to enclose the filename in two sets of quotes. I’m guessing that one is for scp itself, and the other is for the target machine to resolve:

<code>scp user@remote-pc:"'/home/user/my long filename'" ./</code>

Notice that the path is wrapped in single quotes, and then the single quotes wrapped in double quotes. This seems to resolve the issue nicely, and still works with directories as well.