I am attempting to hook a USB scanner to a FC6 box and have the usual problem of only being able to scan (and find the scanner) as root.
How do I go about fixing this?
On Wed, 2007-02-28 at 12:19 -0600, Frank Cox wrote:
I am attempting to hook a USB scanner to a FC6 box and have the usual problem of only being able to scan (and find the scanner) as root.
How do I go about fixing this?
Well, there's lots and lots of udev rules regarding scanners. The one you probably are most interested in is in /etc/udev.d/50-udev.rules.
Look for the stanza:
ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", SYSFS{type}=="[36]", \ SYMLINK+="scanner scanner-%k", MODE="0660"
and change the MODE bit to "MODE=0666". That will change the scanner's mode to "rw-rw-rw-" next time it's seen, so unplug it and plug it back in after the change to /etc/udev.d/50-udev.rules.
---------------------------------------------------------------------- - Rick Stevens, Principal Engineer rstevens@vitalstream.com - - VitalStream, Inc. http://www.vitalstream.com - - - - The world is coming to an end ... SAVE YOUR FILES!!! - ----------------------------------------------------------------------
On Wed, 28 Feb 2007 10:41:41 -0800 Rick Stevens rstevens@vitalstream.com wrote:
On Wed, 2007-02-28 at 12:19 -0600, Frank Cox wrote:
I am attempting to hook a USB scanner to a FC6 box and have the usual problem of only being able to scan (and find the scanner) as root.
How do I go about fixing this?
Well, there's lots and lots of udev rules regarding scanners. The one you probably are most interested in is in /etc/udev.d/50-udev.rules.
Look for the stanza:
ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", SYSFS{type}=="[36]", \ SYMLINK+="scanner scanner-%k", MODE="0660"
and change the MODE bit to "MODE=0666". That will change the scanner's mode to "rw-rw-rw-" next time it's seen, so unplug it and plug it back in after the change to /etc/udev.d/50-udev.rules.
That doesn't seem to have done it.
scanimage -L tells me:
device `epson:libusb:005:004' is a Epson GT-8300 flatbed scanner
However, ll /proc/bus/usb/005 shows me this:
total 0 -rw-r--r-- 1 root root 43 Feb 28 06:56 001 -rw-r--r-- 1 root root 50 Feb 28 06:56 004
Rick Stevens wrote:
On Wed, 2007-02-28 at 12:19 -0600, Frank Cox wrote:
I am attempting to hook a USB scanner to a FC6 box and have the usual problem of only being able to scan (and find the scanner) as root.
How do I go about fixing this?
Well, there's lots and lots of udev rules regarding scanners. The one you probably are most interested in is in /etc/udev.d/50-udev.rules.
Look for the stanza:
ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", SYSFS{type}=="[36]", \ SYMLINK+="scanner scanner-%k", MODE="0660"
This udev rule is for SCSI scanners, so it probably is not going to affect a USB scanner.
and change the MODE bit to "MODE=0666". That will change the scanner's mode to "rw-rw-rw-" next time it's seen, so unplug it and plug it back in after the change to /etc/udev.d/50-udev.rules.
This is probably not going to work, because /dev/scanner* and /dev/usb/scanner* permissions are controlled by console.perms. So they will be set to mode 600 and owner root is no-one is logged in at the console, and to the console owner if there is. But if you are not getting the scanner symlink, then the problem is probably that it is not covered by rules in 60-libsane.rules
It would probably help to see any log messages generated when you plug in the scanner.
Mikkel
On Wed, 28 Feb 2007 13:32:46 -0600 "Mikkel L. Ellertson" mikkel@infinity-ltd.com wrote:
It would probably help to see any log messages generated when you plug in the scanner.
From /var/log/messages:
Feb 28 14:55:59 bargainhunter kernel: usb 5-4: USB disconnect, address 4 Feb 28 14:56:16 bargainhunter kernel: usb 5-4: new high speed USB device using ehci_hcd and address 5 Feb 28 14:56:16 bargainhunter kernel: usb 5-4: configuration #1 chosen from 1 choice
On Wed, 2007-02-28 at 13:32 -0600, Mikkel L. Ellertson wrote:
Rick Stevens wrote:
On Wed, 2007-02-28 at 12:19 -0600, Frank Cox wrote:
I am attempting to hook a USB scanner to a FC6 box and have the usual problem of only being able to scan (and find the scanner) as root.
How do I go about fixing this?
Well, there's lots and lots of udev rules regarding scanners. The one you probably are most interested in is in /etc/udev.d/50-udev.rules.
Look for the stanza:
ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", SYSFS{type}=="[36]", \ SYMLINK+="scanner scanner-%k", MODE="0660"
This udev rule is for SCSI scanners, so it probably is not going to affect a USB scanner.
and change the MODE bit to "MODE=0666". That will change the scanner's mode to "rw-rw-rw-" next time it's seen, so unplug it and plug it back in after the change to /etc/udev.d/50-udev.rules.
This is probably not going to work, because /dev/scanner* and /dev/usb/scanner* permissions are controlled by console.perms. So they will be set to mode 600 and owner root is no-one is logged in at the console, and to the console owner if there is. But if you are not getting the scanner symlink, then the problem is probably that it is not covered by rules in 60-libsane.rules
You're right regarding SCSI vs. USB. I suspect a similar line in udev might handle USB as well, but I've not tried it. Regardless, couldn't one could change the /etc/security/console.perms.d/50-default.perms file to use 666 permissions? All the he's really worried about is allowing anyone to use the scanner, not who owns it.
It would probably help to see any log messages generated when you plug in the scanner.
Mikkel
Do not meddle in the affairs of dragons, for thou art crunchy and taste good with Ketchup!
---------------------------------------------------------------------- - Rick Stevens, Principal Engineer rstevens@vitalstream.com - - VitalStream, Inc. http://www.vitalstream.com - - - - "Hello. My PID is Inigo Montoya. You `kill -9'-ed my parent - - process. Prepare to vi." - ----------------------------------------------------------------------
On Wed, 28 Feb 2007 14:41:51 -0800 Rick Stevens rstevens@vitalstream.com wrote:
You're right regarding SCSI vs. USB. I suspect a similar line in udev might handle USB as well, but I've not tried it. Regardless, couldn't one could change the /etc/security/console.perms.d/50-default.perms file to use 666 permissions? All the he's really worried about is allowing anyone to use the scanner, not who owns it.
Unfortunately, I don't have a /dev/scanner or /dev/usb/scanner device as listed in /etc/security/console.perms.d/50-default.perms; this scanner doesn't seem to do whatever it needs to do to create one.
It works, though -- I can scan as root.
On Wed, 28 Feb 2007 17:16:16 -0600 Frank Cox theatre@sasktel.net wrote:
Unfortunately, I don't have a /dev/scanner or /dev/usb/scanner device as listed in /etc/security/console.perms.d/50-default.perms; this scanner doesn't seem to do whatever it needs to do to create one.
Hmm... I lied. I don't have /dev/scanner (which is what I was looking for), but I do have /dev/scanner-usbdev5.5. I shall now edit /etc/security/console.perms.d/50-default.perms and see if that solves the problem.
Frank Cox wrote:
On Wed, 28 Feb 2007 17:16:16 -0600 Frank Cox theatre@sasktel.net wrote:
Unfortunately, I don't have a /dev/scanner or /dev/usb/scanner device as listed in /etc/security/console.perms.d/50-default.perms; this scanner doesn't seem to do whatever it needs to do to create one.
Hmm... I lied. I don't have /dev/scanner (which is what I was looking for), but I do have /dev/scanner-usbdev5.5. I shall now edit /etc/security/console.perms.d/50-default.perms and see if that solves the problem.
That should already be covered. It uses /dev/scanner* - unless udev is not calling pam-console. What does ls -l /dev/scanner-usbdev5.5 show?
Mikkel
On Wed, 28 Feb 2007 17:41:01 -0600 "Mikkel L. Ellertson" mikkel@infinity-ltd.com wrote:
What does ls -l /dev/scanner-usbdev5.5 show?
lrwxrwxrwx 1 root root 15 Feb 28 14:56 /dev/scanner-usbdev5.5 -> bus/usb/005/005
ll /dev/bus/usb/005/ shows me this: total 0 crw-r--r-- 1 root root 189, 512 Feb 28 12:56 001 crw------- 1 matthew root 189, 516 Feb 28 17:25 005
I'm waiting for "matthew" to log out so I can see what happens to that permission then.
On Wed, 28 Feb 2007 18:14:57 -0600 Frank Cox theatre@sasktel.net wrote:
I'm waiting for "matthew" to log out so I can see what happens to that permission then.
ll /dev/bus/usb/005/ total 0 crw-r--r-- 1 root root 189, 512 Feb 28 12:56 001 crw-rw-rw- 1 root root 189, 516 Feb 28 17:25 005
Perfect! Works like a charm!
Frank Cox wrote:
On Wed, 28 Feb 2007 14:41:51 -0800 Rick Stevens rstevens@vitalstream.com wrote:
You're right regarding SCSI vs. USB. I suspect a similar line in udev might handle USB as well, but I've not tried it. Regardless, couldn't one could change the /etc/security/console.perms.d/50-default.perms file to use 666 permissions? All the he's really worried about is allowing anyone to use the scanner, not who owns it.
Unfortunately, I don't have a /dev/scanner or /dev/usb/scanner device as listed in /etc/security/console.perms.d/50-default.perms; this scanner doesn't seem to do whatever it needs to do to create one.
It works, though -- I can scan as root.
The problem is that unless the permission is changed, access to USB devices are limited to root. I am not sure what scanner you have, but it looks like it is not one of the ones covered in 60-libsane.rules. You may want to follow the instructions at the top of that file to add it in. You can get the idVender and idProduct from /proc/bus/usb/devices, or by using lsusb. After there is a rule to create the scanner symlink, console.perms should take care of setting the correct permissions.
Mikkel
Rick Stevens wrote:
On Wed, 2007-02-28 at 13:32 -0600, Mikkel L. Ellertson wrote:
This is probably not going to work, because /dev/scanner* and /dev/usb/scanner* permissions are controlled by console.perms. So they will be set to mode 600 and owner root is no-one is logged in at the console, and to the console owner if there is. But if you are not getting the scanner symlink, then the problem is probably that it is not covered by rules in 60-libsane.rules
You're right regarding SCSI vs. USB. I suspect a similar line in udev might handle USB as well, but I've not tried it. Regardless, couldn't one could change the /etc/security/console.perms.d/50-default.perms file to use 666 permissions? All the he's really worried about is allowing anyone to use the scanner, not who owns it.
It should already be setting it to let the user logged into the console scan. But you could change the setting for <scanner> in 50-default.perms. You would want to change both permissions, so that it would work even if no-one is logged into the console.
The rules for USB scanners are in 60-libsane.rules along with most of the other scanner rules.
Mikkel