[sane-devel] Query

Henning Meier-Geinitz henning@meier-geinitz.de
Thu, 12 Jun 2003 10:12:08 +0200


Hi,

On Thu, Jun 12, 2003 at 10:29:34AM +1000, Homer wrote:
> I know it's a really silly question but I'd thought I'd ask it anyway.

It's not that silly.

> I'm using mandrake 9.1 and the Xsane package will detect and setup my
> canon N640P. It will run as root but not as my normal user. I've
> actually scanned from root but the scanner won't detect from user.
> It's probably a very simple answer to this but I've missed it
> somewhere, any reasonable suggestions will be appreciated to fix this
> problem. 

The answer is simple: it's a permission proble. The solution depends
on how you access you USB scanner. Either you use libusb or
/dev/usb/scanner*. "scanimage -L" prints which one you use.

The manpage sane-usb describes on how to setup permissions for these
two cases:

LIBUSB

       The permissions for the device files used by libusb  must  be
       adjusted  for  user
       access.  Otherwise  only  root  can  use  SANE devices. For
       Linux, the devices are
       located in /proc/bus/usb/. There are directories named e.g.
       "001" (the  bus  name)
       containing  files "001", "002" etc. (the device files). The
       right device files can
       be found out by running scanimage -L as root. Setting
       permissions with "chmod"  is
       not permanent, however. They will be resetted after reboot or
       replugging the scan-
       ner. It's also possible to mount the usbfs with the option
       "devmode=0666", e.g. by
       using the following line in /etc/fstab:

              none /proc/bus/usb usbfs defaults,devmode=0666  0  0

       However,  this way everyone has access to all USB devices.
       Another way to set per-
       missions is to use the hotplug utilities
       (http://linux-hotplug.sourceforge.net/),
       which  support  dynamic  setting of access permissions. Last,
       the frontends can be
       run as root. However, that's not recommended for security
       reasons.
       

GENERIC KERNEL SCANNER DRIVER
       Ensure  that  the access permissions for the USB device are set
       appropriately.  We
       recommend to add a group "scanner" to /etc/group which
       contains  all  users  that
       should  have  access  to the scanner.  The permission of the
       device should then be
       set to allow group read and write access.  For example, if the
       scanner is  at  USB
       device /dev/usb/scanner0, then the following two commands would
       set the permission
       correctly:

              $ chgrp scanner /dev/usb/scanner0
              $ chmod 660 /dev/usb/scanner0
	      

Bye,
  Henning