View Full Version : xsane as root

20th July 2004, 07:50 AM
I am having a problem with my Canon Scanner - LIDE 30 in xsane. I have to be logged on as root to scan. If I log on as a user xsane does not find the scanner. I 'think' it is a permission problem or broken symlink, but I can't put my finger on it. Here is the output of scanimage as root;

# scanimage -L
device `plustek:libusb:002:002' is a Canon N1240U/LiDE30 USB flatbed scanner

Here is the output of scanimage as user;

# scanimage -L
No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).

Here is the output of sane-find-scanner as user;

# sane-find-scanner
# No SCSI scanners found. If you expected something different, make sure that
# you have loaded a SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x04a9, product=0x220e, chip=LM983x?) at libusb:002:002
# Your USB scanner was (probably) detected. It may or may not be supported by
# SANE. Try scanimage -L and read the backend's manpage.

# Scanners connected to the parallel port or other proprietary ports can't be
# detected by this program.

# You may want to run this program as root to find all devices. Once you
# found the scanner devices, be sure to adjust access permissions as
# necessary.

Can anyone tell me what is going on? I don't really mind scanning as root, but if I want to fax scanned documents I have to go into all of them and change permissions so efax-gtk can fax then as user...it's a bit of a hastle. Thank-you.

20th July 2004, 09:20 AM
maybe a look at the readme will help you:

While SANE automatically uses libusb when the library and its header file were
present during the build of sane-backends, setting permissions will require
some attention.

The device files used by libusb are located in /proc/bus/usb/
(e.g. /proc/bus/usb/001/003). The exact file name can be found out by running
sane-find-scanner which would print "libusb:001:003" in this case. While
setting permissions with e.g. "chmod a+rw /proc/bus/usb/001/003" seems to work,
this change is not permanent. The permissions will be reset when the scanner is
replugged or Linux is rebooted.

One solution to set permissions on-the-fly are the Linux hot-plug tools that
should come with any current distribution. SANE itsself comes with a hotplug
script and related documentaion in the tools/hotplug/ directory. Please refer to
the README in that directory for the details.

it's from an actual cvs version, don't know how about earlier versions, but you might give it a try ...


20th July 2004, 11:05 AM
Thanks for the reply. The tools/hotplug/ directory doesn't exist here. A bit more information - if I replug the scanner after the machine has booted, xsane starts as 'user' for the rest of that session. Here is the script that is the brains behind FC2 hotplugging - anyone spot any issues? I think it's broken. In response to the questions it asks;
a.) There is no file etc/hotplug/usermap.
b.) The command returns;
cat: /var/lock/console.lock: No such file or directory
c.) Who knows, I think the support is broken.
d.) The hotplug package is installed.

oh, and since the usermap file doesn't exist, I can't be sure if the "libusbscanner" is named correctly.

================================================== ========
# $Id: libusbscanner,v 1.1 2004/05/04 13:05:27 twaugh Exp $
# /etc/hotplug/usb/libusbscanner
# Sets up newly plugged in USB scanner so that the user who owns
# the console according to pam_console can access it from user space
# Note that for this script to work, you'll need all of the following:
# a) a line in the file /etc/hotplug/usermap that corresponds to the
# camera you are using.
# b) a setup using pam_console creates the respective lock files
# containing the name of the respective user. You can check for that
# by executing "echo `cat /var/{run,lock}/console.lock`" and
# verifying the appropriate user is mentioned somewhere there.
# c) a Linux kernel supporting hotplug and usbdevfs
# d) the hotplug package (http://linux-hotplug.sourceforge.net/)
# In the usermap file, the first field "usb module" should be named
# "libusbscanner" like this script.

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
# New code, using lock files instead of copying /dev/console permissions
# This also works with non-gdm logins (e.g. on a virtual terminal)
# Idea and code from Nalin Dahyabhai <nalin@redhat.com>
if [ -f /var/run/console.lock ]
CONSOLEOWNER=`cat /var/run/console.lock`
elif [ -f /var/lock/console.lock ]
CONSOLEOWNER=`cat /var/lock/console.lock`
if [ -n "$CONSOLEOWNER" ]
chmod 0000 "${DEVICE}"
chmod 0600 "${DEVICE}"

21st July 2004, 01:36 PM
the tools/hotplug directory which is meant could be found when you unzip the source code; i don't think you will find this anywhere when you're using rpm version of sane-backends. a look at the readme gives following answer:

If you intend to use a USB scanner with libusb and Linux, you should install the
hotplug package, and then take the following steps :
o Copy the libsane.usermap and libusbscanner files from this directory to

(and so on ...)

so perhaps you'll want to take a closer look at the source code of sane and compile it yourself, better answers are found in the readme files.

good luck

22nd July 2004, 03:42 PM
There is a bug open on this, no resolution yet.

Thanks to all who helped.


27th January 2005, 03:36 PM
i`m having the same problem check thih page maybe will help

5th May 2005, 11:18 AM

Got last night my parport0 scanner running as non root. Just rightclicked with Konqueror /dev/parport0. Preferences from parport0 showed: User=root, group=lp. So i added myself to group "lp". After that i could scann as non root. Perhaps you could do the same with your device libusb:002:002? Just a guess ...