Hi Vincent,
I'll show you the workaround I took in order to apply permanently the permissions.
First I identify the SCSI devices:
Code:
sudo apt-get install lsscsi
lsscsi -g
You might get something similar to the following:
Code:
[0:0:1:0] cd/dvd HL-DT-ST DVDRAM GSA-4120B A102 /dev/sr0 /dev/sg0
[2:0:2:0] process HP C5110A 3701 - /dev/sg4
[3:0:0:0] disk ATA ST31000528AS CC38 /dev/sda /dev/sg1
[4:0:0:0] disk ATA Maxtor 6V320F0 VA11 /dev/sdb /dev/sg2
[5:0:0:0] disk ATA MAXTOR STM332082 3.AA /dev/sdc /dev/sg3
Note that my scanner is at /dev/sg4.
Now I list the detailed info about the scanner:
Code:
udevadm info -a -p /sys/class/scsi_generic/sg4
And I get this output:
Code:
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/pci0000:00/0000:00:14.4/0000:03:06.0/host2/target2:0:2/2:0:2:0/scsi_generic/sg4':
KERNEL=="sg4"
SUBSYSTEM=="scsi_generic"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:14.4/0000:03:06.0/host2/target2:0:2/2:0:2:0':
KERNELS=="2:0:2:0"
SUBSYSTEMS=="scsi"
DRIVERS==""
ATTRS{device_blocked}=="0"
ATTRS{type}=="3"
ATTRS{scsi_level}=="3"
ATTRS{vendor}=="HP "
ATTRS{model}=="C5110A "
ATTRS{rev}=="3701"
ATTRS{state}=="running"
ATTRS{timeout}=="0"
ATTRS{iocounterbits}=="32"
ATTRS{iorequest_cnt}=="0x835"
ATTRS{iodone_cnt}=="0x835"
ATTRS{ioerr_cnt}=="0x1"
ATTRS{modalias}=="scsi:t-0x03"
ATTRS{evt_media_change}=="0"
ATTRS{dh_state}=="detached"
ATTRS{queue_depth}=="2"
ATTRS{queue_type}=="none"
looking at parent device '/devices/pci0000:00/0000:00:14.4/0000:03:06.0/host2/target2:0:2':
KERNELS=="target2:0:2"
SUBSYSTEMS=="scsi"
DRIVERS==""
looking at parent device '/devices/pci0000:00/0000:00:14.4/0000:03:06.0/host2':
KERNELS=="host2"
SUBSYSTEMS=="scsi"
DRIVERS==""
looking at parent device '/devices/pci0000:00/0000:00:14.4/0000:03:06.0':
KERNELS=="0000:03:06.0"
SUBSYSTEMS=="pci"
DRIVERS=="aic7xxx"
ATTRS{vendor}=="0x9004"
ATTRS{device}=="0x7178"
ATTRS{subsystem_vendor}=="0x0000"
ATTRS{subsystem_device}=="0x0000"
ATTRS{class}=="0x010000"
ATTRS{irq}=="21"
ATTRS{local_cpus}=="00000000,00000003"
ATTRS{local_cpulist}=="0-1"
ATTRS{modalias}=="pci:v00009004d00007178sv00000000sd00000000bc01sc00i00"
ATTRS{numa_node}=="0"
ATTRS{dma_mask_bits}=="32"
ATTRS{consistent_dma_mask_bits}=="32"
ATTRS{broken_parity_status}=="0"
ATTRS{msi_bus}==""
looking at parent device '/devices/pci0000:00/0000:00:14.4':
KERNELS=="0000:00:14.4"
SUBSYSTEMS=="pci"
DRIVERS==""
ATTRS{vendor}=="0x1002"
ATTRS{device}=="0x4384"
ATTRS{subsystem_vendor}=="0x0000"
ATTRS{subsystem_device}=="0x0000"
ATTRS{class}=="0x060401"
ATTRS{irq}=="0"
ATTRS{local_cpus}=="00000000,00000003"
ATTRS{local_cpulist}=="0-1"
ATTRS{modalias}=="pci:v00001002d00004384sv00000000sd00000000bc06sc04i01"
ATTRS{numa_node}=="0"
ATTRS{dma_mask_bits}=="32"
ATTRS{consistent_dma_mask_bits}=="32"
ATTRS{broken_parity_status}=="0"
ATTRS{msi_bus}=="1"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
Then I create a new rule that will apply to SCSI scanners.
Code:
sudo gedit /etc/udev/rules.d/45-scsi-scanner.rules
In my case it contains the following. You might change the vendor & model according to the last command output.
Code:
# permissions for HP ScanJet 5p SCSI scanner
SUBSYSTEM=="scsi_generic",ATTRS{vendor}=="HP",ATTRS{model}=="C5110A", NAME="%k", SYMLINK="scanner%n", MODE="0660", GROUP="scanner"
Then I simply create a new system group called scanner, which will be the one with rights to use the device.
Code:
sudo addgroup --system scanner
And assign the users that are able to scan:
Code:
sudo adduser USERNAME scanner
Hope it works for you too.
All the best.
Bookmarks