I picked up an HP Photosmart 2575 All in One; Printer-Scanner-Copier the other day. HP's linux support is impressive. I was scanning and printing in no time. Next step was to get scanning and printing working on every computer on the network. Now the 2575 has a built in ethernet port but I decided to use the ubuntu deskop PC for sharing the printer and scanner instead . It is a bit tricky setting scanner sharing up in ubuntu and I could not find a concise how-to anywhere so in the spirit of linux I decided to share what I learned. This info should be applicable to most modern distro's although some of it is debian specific.
This how-to assumes you have the printer and scanner working properly from the local machine. The how-to also assumes you will be using the groupid saned for scanning tasks.
You will need to apt-get the following software for your ubuntu box.
sane
sane-utils "this package has the saned daemon".
xinetd "needed to start the saned daemon"
I also grabbed xsane and any desired gimp plugins.
OK software is installed, now we need to edit a few files.
Add a line to /etc/inetd.conf like this.
sane-port stream tcp nowait saned.saned /usr/sbin/saned saned
Now add the following lines to the end of /etc/xinetd.conf
service sane-port
{
socket_type = stream
server = /usr/sbin/saned
protocol = tcp
user = saned
group = saned
wait = no
disable = no
}
xinet.d should have been added to the services startup on ubuntu when you installed the package So no further xinet.d configuration was necessary. Make sure to add it to startup if your distro doesn't do it for you.
My scanner was setup by udev as /dev/sg0 with ownership of root and group root. To make saned work I needed to change the group to saned.
First make sure saned exists in /etc/group then add any users to the saned group that you want to have scanner access.
The line in my /etc/group looks like this
saned:x:113:username1,username2
Now to make the ownership of /dev/sg0 correct edit /etc/udev/libsane-extras.rules
(is this a debian specific file?)
The line you need to add must be between the lines titled "SUBSYSTEM" and "LABEL"
Now you may have some lines there already. if one of them matches your scanner then you are in luck. There wasn't one for mine so after reading the lines there I figured out it was using the id strings that you see for the scanner when you type lsusb. For my 2575 All in One, lsbusb stated the following.
Bus 005 Device 002: ID 03f0:4e11 Hewlett-Packard
So I created 2 lines. The first is just a comment telling what scanner this is for. The second line is the actual magic that reads the id strings and assigns the scanner to groupid saned.
# Hewlet-Packard 2575 All In One
SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="4e11", MODE="664", GROUP="saned", RUN+="/etc/hotplug.d/usb/libsane.hotplug"
My blog may be truncating the second line. The line should begin with SYSFS and end with libsane.hotplug. There is 1 space between saned", and RUN+
Also make sure /etc/services has a line similar to this. Ubuntu already had this.
sane-port 6566/tcp sane saned # SANE network scanner daemon
Now reboot your computer to make the changes take effect.
On the clients you want to scan from you need to install sane, the sane-utils, and Xsane if you want a gui. Then edit /etc/sane.d/net.conf and add the ip address of the saned server. For example;
192.168.1.199
That is it, You should be good to go. Security wise don't run the sane.d service on a computer directly visible to the net as it may be a security hole. Either use a firewall to block port 6566 or if using a router send 6566 incoming to a non existing internal IP in your port forwarding tables.
UPDATE:
Upgraded to ubuntu 7.10 gutsy gibbon and there are some changes to setting this up.
There is no longer a file /etc/udev/libsane-extras.rule I instead edited /etc/udev/rules.d/45-libsane.rules
Also /etc/inetd.conf no longer exists. I created the file and inserted the line mentioned above but I am not sure if that is any longer necessary.
The big problem seems to be that saned refuses to work if run as user saned. if you edit /etc/xinetd.conf as above and set the saned user and group to root it will work but that is a terrible idea if your computer is exposed to the internet. I am looking for a fix which doesn't involve running the daemon as root but have not found it yet.
Further UPDATE:
With 8.04 hardy heron the udev rule file has changed yet again. Now edit /etc/udev/rules.d/025_libsane-extras.rules
instead of 45=libsane-rules.