-
Notifications
You must be signed in to change notification settings - Fork 17
Adding Remote Scanners
On the linux system sharing the scanner we need to have a static IP address
A static address should be set to one that will not be given by the DHCP server
There are lots of ways to do this, I will let you look that up
- Rasbian Jessie does this in a non standard way using
/etc/dhcpcd.confand on that note you don't want to use Rasbian Wheezy for this, the version ofsane-utilsit has is affected by a bug that makes segfaults happen frequently with network scanning, so upgrade 1st. - You can have your router assign a static address to any system based on it's MAC address (if your firmware has that option)
Now that that is out of the way edit the /etc/default/saned file.
Set the RUN setting to yes:
# Defaults for the saned initscript, from sane-utils
# Set to yes to start saned
RUN=yes
# Set to the user saned should run as
RUN_AS_USER=saned
Next we need to edit the /etc/sane.d/saned.conf file
In this file we need to set the IP address(es) that are allowed to use the scanner
You can check your address using ifconfig, the address of my system with the scanner is 10.0.0.25 and my PHP-Scanner-Server install is at 10.0.0.50
Therefore we know 10.0.0.50 needs access to the scanner, so we could use 10.0.0.50 here or we can just allow every system on our local network to use it, then if someone wants to use simple-scan (overly simplified) or xsane they can, to do that we just change the last number of the IP address to 0 and add /24, so 10.0.0.0/24 if your address was say 192.168.1.168 you would use 192.168.1.0/24
/etc/sane.d/saned.conf:
# saned.conf
# Configuration for the saned daemon
## Daemon options
# Port range for the data connection. Choose a range inside [1024 - 65535].
# Avoid specifying too large a range, for performance reasons.
#
# ONLY use this if your saned server is sitting behind a firewall. If your
# firewall is a Linux machine, we strongly recommend using the
# Netfilter nf_conntrack_sane connection tracking module instead.
#
# data_portrange = 10000 - 10100
## Access list
# A list of host names, IP addresses or IP subnets (CIDR notation) that
# are permitted to use local SANE devices. IPv6 addresses must be enclosed
# in brackets, and should always be specified in their compressed form.
#
# The hostname matching is not case-sensitive.
#scan-client.somedomain.firm
#192.168.0.1
#192.168.0.1/29
10.0.0.0/24
#[2001:db8:185e::42:12]
#[2001:db8:185e::42:12]/64
# NOTE: /etc/inetd.conf (or /etc/xinetd.conf) and
# /etc/services must also be properly configured to start
# the saned daemon as documented in saned(8), services(4)
# and inetd.conf(4) (or xinetd.conf(5)).
Now all that is left to do here is restart the saned service:
sudo service saned restart
If you get a error about it being masked, just reboot (saned needs a update cause of systemd)
The last thing to do is tell the system running PHP-Scanner-Server where the scanner is.
You will need to edit /etc/sane.d/net.conf simply add the IP address of the system the scanner is shared from
since the system earlier was using 10.0.0.25, that is what I need to use here.
# This is the net backend config file.
## net backend options
# Timeout for the initial connection to saned. This will prevent the backend
# from blocking for several minutes trying to connect to an unresponsive
# saned host (network outage, host down, ...). Value in seconds.
# connect_timeout = 30
## saned hosts
# Each line names a host to attach to.
# If you list "localhost" then your backends can be accessed either
# directly or through the net backend. Going through the net backend
# may be necessary to access devices that need special privileges.
# localhost
10.0.0.25
Now at this point you should be able to see the remote scanner, if you have a issues make sure the system sharing the scanner can see the scanner.