Anda di halaman 1dari 8

How to share a scanner on your network

By Manolis Tzanidakis on October 27, 2006 (8:00:00 AM)


After hours of research and tweaking, all your computers are connected to each other and the Internet,
and you can print your documents on a printer connected to another system -- but you still must take a
break when someone else wants to use the scanner connected to your system. Save the money
additional scanners would cost by sharing your scanner on your LAN.
Start with SANE (Scanning Access Now Easy), the scanning suite for Linux and other Unix-like
systems. Check the project's list of supported devices. If your scanner is listed, most of the job is
already done.
SANE consists of two packages, sane-backends and sane-frontends. The backends package includes
scanner drivers and command-line interface (CLI) utilities for using the scanner. You'll want to install
this package on both the server and the clients. The frontends package contains graphical and CLIbased front ends for the scanning process. We won't use this package, because we can use one of the
more advanced front ends for SANE; more on that later.
Begin by installing the sane-backends package. Packages and ports are available for most Linux and
BSD distributions. In Debian and Ubuntu the package is called sane-utils; Slackware and Arch simply
name it sane. If you prefer building from source, it's a trivial ./configure; make; make
install process. Documentation is provided in the source tarball. When the installation is done,
check that your scanner is detected by running scanimage -L as root. The output of this command
should look something like the following:
device `plustek:libusb:001:003' is a Epson Perfection 1260/Photo USB
flatbed scanner
While you could run saned, the scanning daemon, as root, it's better to run it as a less privileged user,
saned, instead, to improve security. If the saned user is not added by the package of your distribution,
add it manually with the command:
if ! id saned; then groupadd saned; useradd -g saned -G scanner -s
/bin/false -d /dev/null saned; fi
Add your non-root user to the scanner group with the command usermod -a -G username
scanner.
If your Linux distribution uses UDEV for device node management -- as most modern distributions do
-- you should reboot to ensure that the new udev rules for SANE are loaded and that you're able to scan
as a non-root user. To verify that your system uses UDEV, check for the presence of the directory
/dev/.udev and see whether the udevd process is running with the command ps aux | grep
udevd. You can avoid rebooting and manually restart the udev daemon, but that's not very easy, so it's
better to reboot. If your distribution uses static device nodes, take a look at SANE's README.linux
file for more information on how to manually fix permissions and allow non-root users to access the
scanner. Just to be sure that users other than root can access the scanner, run scanimage -L as the
non-root user you previously added to the scanner group after you reboot; the output should be the
same as before.
Now it's time to configure the saned daemon. Add the hostnames or IP addresses of the hosts you want
to have access to the scanner to the file /etc/sane.d/saned.conf. If you want to provide access to all the
computers on your network, just add your IP subnet -- for example, if your IP address is 192.168.1.1,

your subnet is probably 192.168.1.0/24.


Check that a sane-port line exists in /etc/services, or add the following line if it's not:
sane-port 6566/tcp # SANE network scanner daemon
Saned does not run as a standalone daemon and thus needs inetd (or xinetd) to work. Add the following
line in your /etc/inetd.conf:
sane-port stream tcp nowait saned.saned /usr/sbin/saned saned
Now ask inetd to reload that file with the command kill -HUP `cat /var/run/inetd.pid`
or your distribution's init script. The saned man page includes instructions on how to use xinetd instead
of inetd or tcp_wrappers for more advanced control of access to saned.
The server should now be ready -- time to configure the clients. Install the sane-backends (or sane-utils,
or sane) package on the clients and add the hostname or IP address of the server in /etc/sane.d/net.conf.
Running scanimage -L as root should return something like:
device `net:mars:plustek:libusb:001:003' is a Epson Perfection
1260/Photo USB flatbed scanner
(mars is the hostname of my scanner server.) Now add your non-root user to the scanner group, as
before, and you're done.
From a security perspective this setup is wide open; anyone who can access the network could run
denial-of-service attacks on your server or just start scans to drive you crazy. You should only share a
scanner this way on a protected, firewalled local network.
There are lots of front ends for SANE for all major operating systems; have a look at the complete list
in SANE's home page. I run XSane on my Linux and BSD desktops. If you use Windows on your
clients I suggest using SaneTwain, since I've had the most successful results with it. I installed a
scanner/printer server for a small business years ago and they still happily run SaneTwain on Windows
98 and XP clients without problems.
That's it, enjoy your new scanner server. You have one more reason to be proud of your home or small
business network.

How can I find out if my scanner works with Ubuntu?


1. Simply plug it in and try! If it is a newer model USB scanner, it is likely that it will work
immediately without any further driver or software installations.
2. Hardware Support Component Scanners - check which scanners are supported in your specific
Ubuntu release.
3. SANE project listing of supported scanners - The SANE (Scanner Access Now Easy) project
provides most of the backends to the scanning software on Ubuntu.

Using your scanner


1. Turn on your scanner and place a document or photo face down on the scanner.
2. Go to Applications --> Graphics --> XSane Image Scanner or SimpleScan. Adjust some
settings if required.

3. Press Scan. Alternatively you can also press the "Scan" button on the scanner to open the
scanning dialog.
4. Once the scanning process is finished a thumbnail image is displayed. Save your file.
5. If you want to create a multi-page file exchange the documents on the scanner and repeat the
scanning process until all pages are scanned. Don't forget to Save when you are finished!

"No device available" - what to do?


There could be several reasons why you might get this message:
1. This might be a permissions problem. Try to run the scanning software as root.
2. Your scanner is not supported in Ubuntu. The most common type of unsupported scanners are
old parallel port or Lexmark All-in-One printer/scanner/faxes.
3. The required driver for your scanner has not been autoloaded
4. You need to install the appropriate firmware (probably a *.fw or *.usb) for your particular
scanner. Try to find the firmware file on the documentation provided with your scanner or
search online. Once you got the right firmware file copy it into /usr/share/sane/. Tip: In my
case I got the firmware file from the CD that came with the scanner. If the CD only supports
Windows, try installing the CD with WINE- don't use the program instead search for the
firmware file and coy this file "ccd548.fw" into /usr/share/sane/gt68xx/.
5. For a Mustek 1200 UB Plus scanner you will need this file sbfw.usb. Rename it to "PS1fw.usb"
and then put it in the directory "/usr/share/sane/gt68xx" (remember to give read permission to
all users).
6. Your scanner is parallel port and you are not a member of the scanner group. The device
/dev/parport0 (or whichever parallel port your scanner is connected to) by default is only
readable and writable by user lp and group scanner. You can become member of group scanner:
go to Administrations --> Users and Groups --> Account Properties --> User Privileges.

Install a scanner manually


The SANE project does not always provide complete drivers for all scanners. These drivers can still be
used, but not all features may work. Here is a list of scanners with incomplete drivers:
HP 4200, HP 3300C, HP 4300C, Agfa Snapscan Touch, HP 4400C, HP 4470C
1. Make sure the Universe repository is enabled. The easiest way to do this is probably through
Synaptic.
2. Search Synaptic for "libsane-extras" or alternatively type the following command in the
terminal:
sudo apt-get install libsane-extras

3. Now you need to edit .conf file in /etc/sane.d/dll.conf. To enable the right driver for your
scanner look for the following lines:
# The following backends are not part of the SANE distribution
# but are provided by the libsane-extras Debian package

Below are several commented lines. Uncomment (delete the #) the correct one for your scanner,

e.g.:
HP 4200 - uncomment the hp4200 line.
HP 3300C, HP 3400C, HP 4300C, Afga Snapscan Touch - uncomment the niash line.
HP 4400C, HP 4470C - uncomment the hp_rts88xx line.
4. Save changes to .conf file.
5. Fire up Sane and scan away.
Note: the way Linux' hotplugging stuff works, you may need to plug in the scanner after the computer
has booted..

Specific Scanner Models


Some specific models have been documented here:
Lifetec9385Config
ArtecEplus48uConf
GeniusColorpageVivid4X
KONICA MINOLTA 1690MF

Permission Issues
Add saned to the group which owns your scanner device:
sudo adduser saned scanner

Note: I used sane-find-scanner to determine the device and ls -al /dev/bus/usb/XXX/XXX to identify
the group. Since I have MFC printer/scanner/fax the device happened to be owned by group 'lp' so I
added saned to that group (instead of scanner) to allow it access to the scanner.
ACL permissions for saned
Because of a change is the way access permissions are now applied to devices, saned may still not be
able to access the scanner when it is launched by inetd or xinetd. This can happen even though other
regular users on the server have access. The following bug-report contains a solution to this problem :
saned cannot access the scanner in Hardy

Sharing a Scanner Over a Network


Note: The following documentation was written mostly for Ubuntu 10.10 and earlier. For Ubuntu 11.10
and higher, please see the sane.d tutorial.
There are two common configurations for using a scanner over a network:
1. The scanner is connected a computer - the server - and shared over the network.
2. The scanner is connected directly to the network.

Server-side setup
In this configuration, one computer has a scanner connected by USB or parallel port and shares it with
others on the network. The computer with the scanner connected is called the server and all other
computers on the network wishing to share the scanner are called clients.
Note: Make sure your scanner is installed and working properly on the server computer (i.e. the
computer to which the scanner is physically attached).Test first on that local machine before attempting
to share the scanner over the network.
All computers need to have Sane installed:
sudo apt-get install sane

As saned does not automatically detect a scanner that is shared by a remote computer you will need to
set it up with both, the server and the client.
1. Tell it to run sane as a server (daemon, service)
2. Set the subnet where to share the scanner.
3. On distributions older that 10.10, set inet (or xinet) to listen on the appropriate port (This is
optional, saned can be setup to be running continuously)
4. Make sane run at start up
Sane as a server
Set sane to run as a server, ie expect connections Edit /etc/default/saned to read:
# Set to yes to start saned
RUN=yes

You must be root to edit this file (hint, use sudo)


Share with
Set the subnet that will be able to see the scanner Edit /etc/sane.d/saned.conf to share the printer on
your subnet:
192.168.1.0/24

Make sure it is in your range of IPs. It hit me badly when I mis-configured it for 192.168.0.0 when I
meant 192.168.1.0 !
The /24 means to share with everybody in xxx.xxx.xxx.0 to 255.
User setup
In some cases, correct permissions needs to be set. E.g. for HP DesignJet 2050 All-in-one device, the
saned user has to be inserted into lp group. To do that by typing
sudo adduser saned lp

To verify the saned user has the correct permissions to access the scaner device, run the following
commands:
sudo -s
su -s /bin/bash saned

scanimage -L

As a result, you should see a device identified, e.g.


device `hpaio:/usb/Deskjet_3050_J610_series?serial=CN0CQ3B1DH05HX' is a HewlettPackard Deskjet_3050_J610_series all-in-one

Set (x)inetd
Only needed for 10.04 and previous distributions. You don't need this step if running 10.10, jump to
step four.
Edit /etc/inetd.conf by adding the following line:
sane-port stream tcp nowait saned.saned /usr/sbin/saned saned

Note: that an inetd server need not be installed.


Or, if you are using xinetd, create a file called /etc/xinetd.d/saned and enter the following in the file:
service saned
{
socket_type = stream
server = /usr/sbin/saned
protocol = tcp
user = saned
group = scanner
wait = no
disable = no
}

Note: The saned value (last word on the inet configuration or in the user line in the xinetd
configuration) is the name of the user running the server. You can get it form the RUN_AS_USER= line
on the /etc/default/saned file
restart inetd or xinetd by
sudo /etc/init.d/(x)inetd restart

Run at start-up
Restart saned by (10.10)
sudo service saned restart

or (10.04 and previous)


sudo /etc/init.d/saned restart

One user writes that a reboot is necessary. Not my experience (with 10.10) but YMMV.
To configure the Sane daemon to start automatically at boot up run:
sudo update-rc.d saned defaults

Client-side Setup
From the client, all you need to do is add server name or IP address of the scanner server to
/etc/sane.d/net.conf:
192.168.1.100

Now run xsane and it should pick up the new network scanner.

LAN-based scanners
The scanner is connected directly to the network without any intermediary computer.

Samsung ALL-in-One devices


Add The Samsung Unified Linux Driver Repository by editing /etc/apt/sources.list and adding the
following line:
deb http://www.bchemnet.com/suldr/ debian extra

Then installed the GPG key, update, install scanner driver & discover your scanner:
sudo wget -O - http://www.bchemnet.com/suldr/suldr.gpg | sudo apt-key add sudo apt-get update
sudo apt-get install samsungmfp-scanner
sudo /opt/Samsung/mfp/bin/netdiscovery --all --scanner >.samsung.netdiscovery

HP All-in-One devices
1. Ensure the device is connected to the network and can be pinged.
2. Ensure hplip is installed:
$ sudo apt-get install hplip

3. Run the hp-setup wizard which installs printer, scanner, and any other features.
$ sudo hp-setup

1. For Connection Type choose "Network/Ethernet..."


2. If the device is not detected, click "Show advanced options", tick "Manual discovery" and
supply the scanner's IP address.
4. Check the scanner is now recognized:
$ scanimage -L

For more details, see HpAllInOne.

Brother All-in-One
See this page for the brscan utility and instructions.

Help Ubuntu to support more scanners


There are several ways you can help Ubuntu to support more and more scanners over time.
Support the SANE Project! This project provides most of the scanning backend information for
Ubuntu.
When purchasing a new scanner, always ask if it works in Linux
Contact the manufacturer about supporting your scanner under Linux. Make sure you tell them
about the SANE project!

External links
SANE project (Scanner Access Now Easy)
SANE's scanner howto

Anda mungkin juga menyukai