• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[Gelöst] : USB Scanner Zugriffsrechte

So, wie ich schon oben im Thread geschrieben habe, kann das Scanner-Device von SuSE verschiedene Bus- und fortlaufende Nummern bei jedem Reboot erhalten.

Eine Moeglichkeit trotzdem diesem einem USB-Device die richtige Gruppe (z.B. "scanner") und Berechtigung zu erteilen, besteht in der Ausfuehrung eines kleinen Scripts waehrend des Boot-Vorganges.

Hierzu anliegend ein kleines Beispiel, was das jeweilige USB-Device ermittelt und anschliessend die Permissions richtig setzt (Benutzung auf eigene Gefahr :wink: )

Code:
#!/bin/sh

#
# change the group and the permission to a USB-scanner device in SuSE 10.0
# DO NOT USE IT FOR SCSI- adn/or Paralellport-Scanners !)
#
# if you copy only the contents of this script, then save it in the directory
# /etc. Don`t forget to give execution-permission to this file !
#
# start this script from the file /etc/init.d/boot.local so it could run on every
# boot-up


# from scanimage we get the information in a format like
# ........... `hp:libusb:1:2' ................

# first let`s get the unformated device-info
usbDEV=$(/usr/bin/scanimage -L)

# extract only the usb-BUS-no (i.e. the '1' see above example)
usbBUS=${usbDEV##*\libusb:}
usbBUS=${usbBUS%%:*}

# extract only usb-DEVICE-no (i.e. the '2' see above example)
usbNO=${usbDEV%%\'*}
usbNO=${usbNO##*:}

# ok, now we could create the new device-names (example : /dev/usbdev1.2)
usbNAME="/dev/usbdev$usbBUS.$usbNO"

# at least change the group and the permission
chown root:scanner "$usbNAME"
chmod 0660 "$usbNAME"

# that`s it !

Falls der Sachverhalt eleganter geloest werden kann bitte mir mitteilen. Hoffe es hilft aber :)
 
Oben