Thursday 13 June 2013

Setting up a scan server with Fedora 17 - network scanning with a HP Photosmart C4485 All In One (HP C4400 Series)

I've had my HP Photosmart C4485 All-in-one Printer/Scanner/Copier attached to my Fedora 17 linux server for ages. It's been shared on the network with CUPS, meaning any device in the household can print to it. I recently needed to scan an image for the first time since setting up the server so had to find out a bit about using SANE (linux's scanner service) over the network.

I found some very useful instructions here which I mostly followed: http://www.x2b4.com/2008/06/15/howto-share-you-scanner-on-a-network-with-fedora-9/

I was having problems with scanimage -L not showing the printer/scanner, even though sane-find-scanner was showing it was connected. After a while I realised I didn't have the SANE HPAIO backend. This was fixed with
# yum install libsane-hpaio

I didn't bother creating the script suggested in the link which automatically changes the permissions on the scanner.

I had tried getting saned to run as its own user, but this wasn't working, so I set up the config file under /etc/xinetd.d/ to run saned as root - not ideal for security but it's unlikely that anyone I don't know about will be on the network.

There was a head-scratching moment when I couldn't find the scanner from a client machine (ie the computer I wanted to scan from) until I realised I had to edit the client's /etc/sane.d/net.conf to allow the SANE net backend to connect to the scanner host (ie my server with the scanner attached).

Here's an outline of the steps I took, in a sensible order:
1. Make sure SANE works locally on the server by checking the output from  sane-find-scanner and scanimage -L. (this is after I installed the libsane-hpaio package

2. Configure SANE to share the scanner on the network by adding these lines to the access list in /etc/sane.d/saned.conf :

localhost
192.168.1.0/24
 
(you'll need to change the second line to suit your network's IP address range)

3. Add firewall rules as in the link above, to allow access from the network

4. Create a file in /etc/xinet.d/ to get xinetd to invoke the SANE service when needed (as in the link)

5. On all clients (computers you want to use the scanner from), add the server IP address or hostname to /etc/sane.d/net.conf

Thank you, x2b4!