Network Scanning with SANE and Linux

This afternoon I thought I would have a play with Sane (the Linux scanner interface) to see how hard it is to create a network scanner from any old scanner as long as it is supported by SANE.
It turned out to be far easier than I envisioned. In my case I was running SuSE 9.2.

Install the software

You will need to ensure you have sane, saned (the network daemon) and xinetd (or inetd) installed on your system. Follow the sane docs to setup your scanner locally. This is usually just a case of finding the right sane-backend for your particular scanner.
Once the scanner is detected (using scanimage -L) test the connection by running: scanimage -T

If all is well configure the xinetd sane service by following the documentation here:
http://penguin-breeder.org/sane/saned/
In SuSE most of this work is done for you, all you have to do is enable the service in /etc/xinet.d/sane-port (by commenting out disabled = true).
Then in /etc/sane.d/saned.conf add your network details for the clients and restart xinetd.

Firewall

saned works a little bit like FTP. It has a control connection on port 6566 (TCP & UDP) but it also picks random ports above 1024 to transfer data. Consequently your scanner host should not have a firewall blocking TCP ports above 1024 (at least from your network clients).

Testing from the client

If all is configured correctly you should be able to telnet into the scanner server (telnet servername 6566). Nothing will happen but if you do not get disconnected this is a good thing.

Setup the Client Software

Sane clients can easily access the networked scanner by specifying the network address in their network backend configuration file (usually under sanedirectory/etc/net). There are quite a few clients but I have found the following two very useful.

Windows port of XSane
http://www.xsane.org/xsane-win32.html

Windows SANE-TWAIN Bridge (local archive)
http://sanetwain.ozuzo.net

OSX Sane-TWAIN bridge
http://www.ellert.se/twain-sane/

And of course for Linux desktops there's a whole bunch of sane GUI clients (depending on your distribution and taste).