/dev/uscanner0 owned by root:scanner but only access for users of group operator

Christian Hiris 4711 at chello.at
Thu Dec 2 17:29:48 PST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 02 December 2004 23:06, maarfree at xs4all.nl wrote:
> Hi list,
>
> I have my Canon Lide 20 usb scanner working om my system. Setup was easy
> following the handbook.
>
> But I did not like all users being member of group operator;
> So I added a group scanner,
> to /dev/devfs.rules I add:
> add path uscanner0 mode 0660 group scanner #  (group scanner is added)
> I add a user to group scanner.
> When I do ll /dev/uscanner0
> crw-rw----  1 root  scanner  233,   0 Dec  2 22:24 /dev/uscanner0
> When I do sane-find-scanner as the user I get:
> found USB scanner (UNKNOWN vendor and product) at device /dev/uscanner0
> and subsequently the scanner is not useable for the user.
> But when I add this user to group operator:
> found USB scanner (vendor=0x04a9, product=0x220d) at /dev/uscanner0
> and the scanner is working.
> but I see the scanner still belongs to user root and group scanner...
>
> Anyone an idea?

You probably need to change the corresponding /dev/usbN device nodes, too (I 
must say that, I never tested this with devfs.rules). In my experience 
sane-find-scanner steps thru the usb devices and exits, if it hasn't proper 
permissions on a usb device node. For real-life scanning apps like xsane and 
xscanimage you can define SANE_DEFAULT_DEVICE in your environment. This 
should stop the apps from stepping thru the usb device nodes.

JFYI:
There is a (dirty) way to work around the needs of adding users to a scanner 
specific group. You can set /dev/uscanner0 and the corresponding /dev/usbN to 
world read- and writeable via usbd and usbd.conf. 

% cat /etc/usbd.conf.my
# Scanners
device "Scanner"
        devname "uscanner[0-9]+"
        attach "chmod 666 /dev/${DEVNAME} ; chmod 666 /dev/usb0"
        detach "chmod 660 /dev/usb0"

% cat /etc/rc.conf | grep usb
usbd_enable="YES"                       # Run the usbd daemon.
usbd_flags="-c /etc/usbd.conf.my"       # Flags to usbd (if enabled).

But this method also opens a can of worms:

All devices nodes down to the usb device to where your scanner is connected to 
must be set world read- and writeable. ie. when you connect your scanner 
to /dev/usb1 the devices /dev/usb0, /dev/usb1 and /dev/uscanner0 must be set 
to mode 666. For this reason, I attached my scanner to /dev/usb0. To work 
around this, you can define SANE_DEFAULT_DEVICE as mentioned above.    

- -- 
Christian Hiris <4711 at chello.at> | OpenPGP KeyID 0x3BCA53BE 
OpenPGP-Key at hkp://wwwkeys.eu.pgp.net and http://pgp.mit.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)

iD4DBQFBr8GI09WjGjvKU74RAkh9AJ9bVHPSEhASe87HqQNif/Q4ypLH9gCXQSDn
TNKSbpmUzSS65b6ntdJ69Q==
=Vhy/
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list