2

I have an Epson ET-2756 printer. I'm able to print easily with it, but it took me a long time to understand why under Debian 10 my computer wasn't able to detect its scanner part.

Eventually, I've found why : the scanimage command (and then epsonscan2 specifically installed for the printer) are only able to detect its scanner provided they are ran with a sudo.

I wonder why... And especially, I would like to remove this prerequisite.
How may I remove the need of a sudo to perform a scan?


Experience suggested by cas, below :

# I look already registered as a scanner group member
cat /etc/group | grep scanner
scanner:x:117:saned,lebihan

# But this command fails:
scanimage --format=png >/tmp/test.png
scanimage: no SANE devices found

# While this one succeeds:
sudo scanimage --format=png >/tmp/test.png

2 Answers 2

0

Add your user to the scanner group. i.e.

sudo addgroup yourusername scanner

Next time you login, your uid will be able to use the scanner.

Alternatively, the libpam-systemd package can ensure that the correct permissions are set when a user logs in, if there are appropriate udev rules to do so. It's easier to just add yourself to the scanner group, though.

See the following on the Debian Wiki:

2
  • Thanks. I've edited my question, after having checked that I was in the scanner group: I was in already. Jun 18, 2021 at 6:14
  • OK, you probably need to look at the bug report mentioned in the Scanner#Permissions link. It's mostly about problems with Epson scanners, and has some udev rules that apparently fix the problem (i haven't looked closely at the problem - my scanner is an HP3030 and works fine with just me in group scanner)
    – cas
    Jun 18, 2021 at 6:21
0

Many device access problems can be resolved through group membership changes.

You can find the device name by watching sudo journalctl --follow as you connect your device. OR ls -1 /dev >dev.before, connect the device, wait 10 seconds, ls -1 /dev >dev.after;diff dev.{before,after}.OR, reconnect and ls -lrt /dev | tail.

Specifically, if ls -l shows that the group permissions (the second "rwx" triplet) is "rw" (e.g."-rw-rw----"), then, adding oneself to the group that owns the device will grant rw access.

Here's how:

device="/dev/whatever"
sudo adduser $USER $(stat -c "%G" $device)

This allows you membership in the group that can rw the device, but there is one more step.

To make all your processes members of the new group, logout and login. Group memberships are set up at login time.

To create a single process in the new group (for testing, prior to logout/login):

newgrp $(stat -c "%G" $device)  

or, just type the group name. See man newgrp.

3
  • That sounds scary. What if the group is disk (just imagining here) - better check before adding a user to a system group. Ideally one would create a udev rule and give the device to the users group.
    – Ned64
    Dec 3, 2021 at 22:33
  • @Ned64 What's "scary"? Do you know about the owner/group/world permission scheme? The man command? Blindly following recipes without figuring out what they do is scary.
    – waltinator
    Dec 3, 2021 at 22:48
  • That's exactly what I meant.
    – Ned64
    Dec 4, 2021 at 7:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .