sane.d tutorial

Sharing SANE on the network

About this tutorial...

This tutorial was written based on numerous notes that had been made getting scanners shared out over a LAN on Ubuntu 11.11. These directions should work for most ubuntu systems version 10 and up. Some additional information is below:

sane.d Support under Ubuntu

Sane.d is well supported under Ubuntu linux.

Why sharing

By sharing the scanner over the network, we can allow many other devices to access a scanner or scanners , without having to do nearly as much configuration work. This is especially helpful if you have other versions of linux on your network that may need to access this scanner, but do not have a current version of sane available (e.g. RHEL 6.2).

Assumptions

We made a number of assumptions while writing this tutorial. Watch for these, as you may need to adjust them to fit your situation.
  • Your network is 192.168.0.1
  • Your scanner is already working locally
  • Your scanner server (the machine the scanner is local to) is located at 192.168.0.15
  • Your scanner server is running Ubuntu 11.11 - 12.10

How to share scanners via sane.d

The following step-by-step guide to setting up sane.d should work for the vast majority of scanners. If you need to add scanner specific information, please try and do so on the scanners wiki page.

Step 1: Set up your scanner on sane first

In order to make network scanning work, you first need to get sane working with your scanner. If your scanner is USB scanner DO NOT PROCEED TO STEP 2 until it is correctly scanning via USB.
If your scanner is a network attached scanner, you need to get it working on your saned server BEFORE you try and share it out on the network.

Step 2: Tell sane to run as a server (saned)

  1. We need to edit the file /etc/default/saned to tell the computer to start the saned server. To do that, we will run the following command from a terminal:
$ sudo gedit /etc/default/saned
  1. Look for the section that reads:
# Set to yes to start saned
RUN=no
  1. Edit that so that it reads:
# Set to yes to start saned
RUN=yes
  1. Save, and close gedit

Step 3: Tell saned who to share with

  1. We need to edit the file /etc/sane.d/saned.conf to tell saned who to share with. To do that, we will run the following command from a terminal:
$ sudo gedit /etc/sane.d/saned.conf
  1. Look for the section that reads:
 ## Access list
  1. Since we are on a small office or home network, and we do not need to control access, we will add the line " 192.168.0.0/24" (share with everyone on the local network) after "## Access list"
 ## Access list
 192.168.0.0/24
  1. Find the line that reads
 #data_portrange = 10000 - 10100
  1. Edit that line to read
 data_portrange = 10000 - 10100
  1. Save the file and close gedit

Step 4: Clean up tasks

1. Restart the saned service to get the new configurations by running the following command in a terminal:
$ sudo service saned restart
2. Tell the computer to start saned automatically when the computer boots up by running the following command in a terminal:
$ sudo update-rc.d saned defaults
3. Check to make sure the saned service is up and running
$sudo service saned status
It should return something along the lines of:
       saned start/running, process 804
If it does not, see the section on troubleshooting.

Set up sane clients

Now that you have your server set up, its time to set up your clients.

Step 1: Set up your Linux clients to use this shared scanner

1. We need to tell the client computer where to find the saned server we want to connect with. To do that, we have to edit the file /etc/sane.d/net.conf by running the following command:
$ sudo gedit /etc/sane.d/net.conf
2. Find the line that reads
 ## saned hosts
3. After that line, you need to add a line with the address of the ubuntu box we installed the server on. That line will look like this:
 ## saned hosts
 192.168.0.15
4. Find the line that reads
 # connect_timeout = 60
5. and change it so that it reads:
 connect_timeout = 60
6. Save the file and close gedit.
7. From a terminal, run
$ xsane
and you should see you scanner.

Step 2: Set up your MAC/Windows clients

It is often best to use the scanner drivers that shipped with your scanner for Mac and Windows clients and connect directly to the scanner. If that is not an option, the following solutions are available:

Windows

The easiest method of connecting Windows computers to SANE scanners is to use SANEWinDS [http://en.landdownload.com/sanewin.html]. SANEWin allows windows computers to connect to SANE servers, and provides a TWAIN interface, allowing you to use any Windows scanning application to acquire and manage your scans.
The saneTWAIN bridge is a most popular method for using sane network scanners in a Windows system. For more information on this project, see [http://sanetwain.ozuzo.net/]

Mac

Twain-sane is a bridge for the MAC platform (10.6, 10.7) that allows you to use a sane shared scanner with any twain enabled Mac program. For more on this project, see http://www.ellert.se/twain-sane/ If you really need to, sane front ends are available for these platforms.

Trouble-shooting

If your network scanner does not work, the following procedures may be of help. Try to follow these steps in order.

Make sure your scanner works locally

From the server that is sharing out the scanner, make sure you can scan. If it doesn't work locally, it won't work remotely.

Make sure the saned service is running

From the server sharing out saned, run the following command:
$ sudo service saned status
it should show the saned service as up and running.

Test if the server can reach its own saned on localhost

Instead of using the scanner directly, try and access it via the localhost interface. IF this doesn't work, it won't work across the network.
To access the scanner via the local saned server,

Export the scanner to localhost

  1. Edit the saned.conf file by running the following command:
$ sudo gedit /etc/sane.d/saned.conf
  1. Look for the section that reads:
 ## Access list
and add the following lines:
 ## Access list
 localhost
 127.0.0.1
Save the file and close gedit.

Tell sane to use localhost

From the command line, run the following command to open net.conf in gedit:
$ sudo gedit /etc/sane.d/net.conf
Look for the section that reads:
 ## saned hosts
We need to add a line to tell sane to use localhost for a host:
 ## saned hosts
 localhost
 127.0.0.1

Fire up xsane to test it out...

From the command line, run:
$ xsane
You should now see two copies of your scanner. Make sure both can actually scan.

Check using xsane and command line options

From the command line, run the command
xsane [driver]:net"192.168.0.15
Assuming that your scanner uses the epson2 backend, the command would be:
xsane epson2:net:192.168.0.15

Check the local connection with telnet

IF the above procedure doesn't work, you need to make sure you can connect to the saned server with telnet. We also should log what happens. We can do that by running the following commands:
$ sudo netstat -tulpn | egrep '(:6566|saned)' saned-test.log
$ telnet localhost 6566

Manually check other configuration files (advanced)

Their are a number of configuration files that may cause a problem. Please attempt all other solutions before doing down this path (including asking for help!)

/etc/services

Check to make sure the following services are present:
sane-port       6566/tcp                # SANE Control Port
sane-port       6566/udp                # SANE Control Port

/etc/hosts.allow & /etc/hosts.deny

Try temporarily commenting out any entries in these files. If you can scan after doing this, then you will need to specifically add your host or hosts to the /etc/hosts.allow file. The following entry will give access to saned to the local network:
saned  192.168.0.

If all else fails...

If these steps have failed, its time to visit the folks on the sane-devel@lists.alioth.debian.org mailing list. They should be able to help.

Post a Comment