easy steps to get remote scanning working in ubuntu

I have multifunction device, which is connected to one of the Linux boxes in the house. Every once in a while I want to scan something and it's really nice to be able to do so from all of the Linux boxes in the house. Fortunately sane supports that via the saned program.

I just ran into a problem with permissions and figured I'd remind myself how to get this working. So here are the steps.

First make sure that the box on which you want to scan is set to look across the network. That part is easy. Just put the name of the host to which the scanner is connected in the file /etc/sane.d/net.conf.

On the box to which the scanner is physically connected, make sure that your printer was properly detected by running

# scanimage -L
device `hpaio:/usb/Officejet_5600_series?serial=CN667DE1Q304B2' is a Hewlett-Packard Officejet_5600_series all-in-one
#

If it's not found you'll have to solve that first.

Now you need to setup the network part, which is fortunately well documented in the saned man page.

It comes down to installing xinetd

sudo apt-get install xinetd

and then creating a file named /etc/xinetd.d/sane-port with the following in it

# default: off
# description: The sane server accepts requests
# for network access to a local scanner via the
# network.
service sane-port
{
 port        = 6566
 socket_type = stream
 wait        = no
 user        = saned
 group       = saned
 server      = /usr/sbin/saned
}

That's how they tell you to do it in the manual page, but it doesn't work.

After realizing that there was a permissions issue after getting it to work as root and chasing across the net for a solution, I came up with my own easy solution. No mucking with the /etc/udev stuff.

All I needed to do was add the saned user to the scanner group with this command

sudo usermod -a -G scanner saned

and changing the group line in the /etc/xinetd.d/sane-port file to point to the scanner group. The file then looked like this:

# default: off
# description: The sane server accepts requests
# for network access to a local scanner via the
# network.
service sane-port
{
 port        = 6566
 socket_type = stream
 wait        = no
 user        = saned
 group       = scanner
 server      = /usr/sbin/saned
}

Then just restart the xinetd service and you are set.