This is a discussion on sane as non-root? within the Gentoo Linux Support forums, part of the Unix Operating Systems category; --> When I try to run xsane as non-root it does not find any scanners. The same for sane-find-scanner, it ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| When I try to run xsane as non-root it does not find any scanners. The same for sane-find-scanner, it only works as root. I was able to run xsane as root (but that is insane). The gimp, also does not show sane in the aquire menu, even when run by root (do I need to rebuild the gimp with sane support? How?) How can I set up xsane to run by a user. I am in the scanner group. What else is needed? |
| |||
| Ken Scharf has offered us the following clue : > When I try to run xsane as non-root it does not find any scanners. > The same for sane-find-scanner, it only works as root. > I was able to run xsane as root (but that is insane). > The gimp, also does not show sane in the aquire menu, even when > run by root (do I need to rebuild the gimp with sane support? How?) > > How can I set up xsane to run by a user. I am in the scanner group. > What else is needed? When I connect my USB scanner, hotplug launches the script libusbscanner which changes the rights for users. This script is in /etc/hotplug/usb. Look at the end. You have to uncomment the wanted lines. There are two possibilities, depending on your usage (my PC is single home user, I don't care that much). Gimp works OK and launches the scanner. I've a HP OfficeJetV40 with hpoj and a Canon Canoscan Lide 20. #!/bin/sh # This file is part of sane-backends. # # This script changes the permissions and ownership of a USB device under # /proc/bus/usb to grant access to this device to users in the scanner group. # # Ownership is set to root:scanner, permissions are set to 0660. # # Arguments : # ----------- # ACTION=[add|remove] # DEVICE=/proc/bus/usb/BBB/DDD # TYPE=usb if [ -z "$DEVICE" ] ; then IF=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\2:') DEV=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\3:') DEV=$(expr $DEV + 1) DEVICE=$(printf '/proc/bus/usb/%.03d/%.03d' $IF $DEV) fi #Secure version # #if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then # chown root:scanner "$DEVICE" # chmod 0660 "$DEVICE" #fi #That's an insecure but simple alternative #Everyone has access to the scanner if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then chmod 0666 "$DEVICE" fi |
| |||
| Albert wrote: > Ken Scharf has offered us the following clue : > > >>When I try to run xsane as non-root it does not find any scanners. >>The same for sane-find-scanner, it only works as root. >>I was able to run xsane as root (but that is insane). >>The gimp, also does not show sane in the aquire menu, even when >>run by root (do I need to rebuild the gimp with sane support? How?) >> >>How can I set up xsane to run by a user. I am in the scanner group. >>What else is needed? > > > When I connect my USB scanner, hotplug launches the script libusbscanner > which changes the rights for users. This script is in /etc/hotplug/usb. > Look at the end. You have to uncomment the wanted lines. > There are two possibilities, depending on your usage (my PC is single home > user, I don't care that much). > > Gimp works OK and launches the scanner. I've a HP OfficeJetV40 with hpoj and > a Canon Canoscan Lide 20. > > #!/bin/sh > > # This file is part of sane-backends. > # > # This script changes the permissions and ownership of a USB device under > # /proc/bus/usb to grant access to this device to users in the scanner > group. > # > # Ownership is set to root:scanner, permissions are set to 0660. > # > # Arguments : > # ----------- > # ACTION=[add|remove] > # DEVICE=/proc/bus/usb/BBB/DDD > # TYPE=usb > > > if [ -z "$DEVICE" ] ; then > IF=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\2:') > DEV=$(echo $DEVPATH | sed 's:\(bus/usb/devices/\)\(.*\)-\(.*\):\3:') > DEV=$(expr $DEV + 1) > DEVICE=$(printf '/proc/bus/usb/%.03d/%.03d' $IF $DEV) > fi > > > #Secure version > # > #if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then > # chown root:scanner "$DEVICE" > # chmod 0660 "$DEVICE" > #fi > > #That's an insecure but simple alternative > #Everyone has access to the scanner > > if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then > chmod 0666 "$DEVICE" > fi > > I was able to gain access to xsane as a user by "chgrp scanner /dev/sg0" but I'd have to put this in a script as you did because udev recreates these devices at will. I could also modify the rescan-scsi-bus.sh script to do the same. I still don't see sane as an option in gimp for aquire in the file menu tab. What use flags did you use to build the gimp? |
| |||
| Ken Scharf wrote: > I was able to gain access to xsane as a user by > "chgrp scanner /dev/sg0" > but I'd have to put this in a script as you did because > udev recreates these devices at will. > I could also modify the rescan-scsi-bus.sh script to > do the same. What about edit your udev rules and set the sg0 to be owned by the group scanner You have in your BUS=="scsi", KERNEL="sg[0-9]*", ACTION=="add", DRIVER=="sr", GROUP="cdrom" maybe you could change that to BUS=="scsi", KERNEL="sg[0]*", ACTION=="add", DRIVER=="sr", GROUP="scanner" BUS=="scsi", KERNEL="sg[1-9]*", ACTION=="add", DRIVER=="sr", GROUP="cdrom" This will take effect at next bootup (not sure how to make udev to reload rules) > I still don't see sane as an option in gimp for aquire > in the file menu tab. What use flags did you use > to build the gimp? You need to emerge sane-frontends and have USE="gimp" to get the feature for gimp, but it seems to not work that well, so don't count things will work. //Aho |
| |||
| J.O. Aho wrote: > Ken Scharf wrote: >> I still don't see sane as an option in gimp for aquire >> in the file menu tab. What use flags did you use >> to build the gimp? > > You need to emerge sane-frontends and have USE="gimp" to get the feature > for gimp, but it seems to not work that well, so don't count things will > work. Noticed while I looked at the ebuilds, you need to emerge xsane with the USE="gimp" too to get this to work. example: USE="gimp" emerge sane-frontends xsane //Aho |
| |||
| J.O. Aho wrote: > J.O. Aho wrote: > >> Ken Scharf wrote: > > >>> I still don't see sane as an option in gimp for aquire >>> in the file menu tab. What use flags did you use >>> to build the gimp? >> >> >> You need to emerge sane-frontends and have USE="gimp" to get the >> feature for gimp, but it seems to not work that well, so don't count >> things will work. > > > Noticed while I looked at the ebuilds, you need to emerge xsane with the > USE="gimp" too to get this to work. > > > example: > USE="gimp" emerge sane-frontends xsane > > > > //Aho Thanks, I will add the flag and rebuild sane. However, I think all I might need to do is to edit the gimp plugin config file, need to google to find the directions for that. |
| |||
| J.O. Aho wrote: > Ken Scharf wrote: > >> I was able to gain access to xsane as a user by >> "chgrp scanner /dev/sg0" >> but I'd have to put this in a script as you did because >> udev recreates these devices at will. >> I could also modify the rescan-scsi-bus.sh script to >> do the same. > > > What about edit your udev rules and set the sg0 to be owned by the group > scanner > the only rules file I have in /etc/udev is 50-udev.rules and it doesn't have any KERNEL="sg " entries at all. Yet I do have an /dev/sg0 when the system is booted with the scanner powered up. > You have in your > > BUS=="scsi", KERNEL="sg[0-9]*", ACTION=="add", DRIVER=="sr", > GROUP="cdrom" > > maybe you could change that to > > BUS=="scsi", KERNEL="sg[0]*", ACTION=="add", DRIVER=="sr", > GROUP="scanner" > BUS=="scsi", KERNEL="sg[1-9]*", ACTION=="add", DRIVER=="sr", > GROUP="cdrom" > > This will take effect at next bootup (not sure how to make udev to > reload rules) > > >> I still don't see sane as an option in gimp for aquire >> in the file menu tab. What use flags did you use >> to build the gimp? > > > You need to emerge sane-frontends and have USE="gimp" to get the feature > for gimp, but it seems to not work that well, so don't count things will > work. > > > //Aho |
| |||
| Ken Scharf wrote: > J.O. Aho wrote: >> Noticed while I looked at the ebuilds, you need to emerge xsane with the >> USE="gimp" too to get this to work. >> example: >> USE="gimp" emerge sane-frontends xsane > Thanks, I will add the flag and rebuild sane. However, I think > all I might need to do is to edit the gimp plugin config file, > need to google to find the directions for that. No, it's not that simple, what you need is include gimp support into the scanning tools, as long as they don't have the support, gimp can't talk with them and therefore can't use the scanner at all, this forces you to recompile sane-frontends and xsane with gimp support (by default this isn't included). //Aho |
| |||
| Ken Scharf wrote: > J.O. Aho wrote: >> Ken Scharf wrote: >> >>> I was able to gain access to xsane as a user by >>> "chgrp scanner /dev/sg0" >>> but I'd have to put this in a script as you did because >>> udev recreates these devices at will. >>> I could also modify the rescan-scsi-bus.sh script to >>> do the same. >> >> What about edit your udev rules and set the sg0 to be owned by the group >> scanner >> > the only rules file I have in /etc/udev is 50-udev.rules > and it doesn't have any KERNEL="sg " entries at all. > Yet I do have an /dev/sg0 when the system is booted with > the scanner powered up. That sounds strange, that they don't setup any rules for sg, feels like you may have an ould or experimental udev, you should at least have sys-fs/udev-079-r1. //Aho |
| ||||
| J.O. Aho wrote: > Ken Scharf wrote: > >> J.O. Aho wrote: >> >>> Ken Scharf wrote: >>> >>>> I was able to gain access to xsane as a user by >>>> "chgrp scanner /dev/sg0" >>>> but I'd have to put this in a script as you did because >>>> udev recreates these devices at will. >>>> I could also modify the rescan-scsi-bus.sh script to >>>> do the same. >>> >>> >>> What about edit your udev rules and set the sg0 to be owned by the group >>> scanner >>> >> the only rules file I have in /etc/udev is 50-udev.rules >> and it doesn't have any KERNEL="sg " entries at all. >> Yet I do have an /dev/sg0 when the system is booted with >> the scanner powered up. > > > That sounds strange, that they don't setup any rules for sg, feels like > you may have an ould or experimental udev, you should at least have > sys-fs/udev-079-r1. > > > //Aho I havn't done a emerge sync recently, but I just checked to see what I have... # emerge -pv udev These are the packages that I would merge, in order: Calculating dependencies ...done! [ebuild R ] sys-fs/udev-070-r1 (-selinux) -static 0 kB |