-
Notifications
You must be signed in to change notification settings - Fork 434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keyboard linux with no-root user, but in "input" group #312
Comments
I've checked for this issue too and I've seen that when you ignore the ensure_root() function, there is this line : device = aggregate_devices('kbd') which need to access the It's quite disappointing since I wanted to use this library in a docker based continuous integration process, and when using the software as a user, it would be annoying to have to launch the app as root each time... I though first that if your user is in the input group it have access to |
i am trying to figure out how to do this as well. I have created a udev rules file in
with the following content
this allows me (as expected) to I am hoping this further info will help us figure out how to use this without sudo. |
I actually figured this out. comment out the two calls to
content:
I am not sure of the security implications of allowing |
sadly my fix does not seem to work on a raspberry pi |
Copying my comment from #489: I agree that requiring root is a big, big requirement, and invalidates the use of this library in many cases. But It's not just The only way forward I see is to enable an alternative X-based input event manager, but that's also a (partially) doomed proposition due to the rise of Wayland. Suggestions welcome. |
Uhh I can run dumpkeys fine without root. Here's my |
Thank you @lyiriyah , you're the first one to report being able to run There are three special groups a user needs to be in to use all
The first two are easy enough to fix and report, so I've removed the I'm not comfortable telling users to mess with their uinput rules at the moment. Can you give the newest version a run to see if it helps with your issue? |
I'll try when I get home |
Has anything changed since last time somebody commented on this? I found this issue while looking into libinput, which I believe uses the same |
My previous comment here summarizes the situation, no news since then. |
I can run "pressed_keys.py" just fine on Linux Mint 20.2, adding tty and input groups. |
Following the discussion here and the linked stackoverflow answer, I ran the following: sudo usermod -a -G tty,input $USER
sudo chmod +0666 /dev/uinput
echo 'KERNEL=="uinput", TAG+="uaccess""' > /etc/udev/rules.d/50-uinput.rules
echo 'SUBSYSTEM=="input", MODE="0666" GROUP="plugdev"' > /etc/udev/rules.d/12-input.rules
echo 'SUBSYSTEM=="misc", MODE="0666" GROUP="plugdev"' >> /etc/udev/rules.d/12-input.rules
echo 'SUBSYSTEM=="tty", MODE="0666" GROUP="plugdev"' >> /etc/udev/rules.d/12-input.rules
loginctl terminate-user $USER and I still see Edit: The segfault I was getting was actually PyQt6 related and had nothing to do with keyboard. So I snipped out that part of my comment. |
I'm getting the same message as Avasam but it is working fine. I think this issue can be closed. |
There was an early initialization attempt whenever the keyboard module was simply imported (this is why you had to use root or setup your groups first to even install)! But I've resolved that in #568 So the solution now is to setup your groups and permissions as described. This is as good as it'll get with the current method of listening for keys. So I also believe this can be closed in favor of #538, #124 and #33 |
fyi there's an ever better solution than root or input group: |
Works on my system after adding my user to the relevant groups. I still get @boppreh Any chance of getting a new version tagged and released to PyPI? I had to find this issue and manually download the latest version, things would be much easier if a new release was tagged. |
Its supposed that keyboard linux only work with root user, and this situation cant never be a solution.
I want to modify system to give access to a generic user (example pi user), to execute python from this user instead root, changing permissions...
As you can see, 'pi' user is supposed to have read and write access to /dev/input/event1, because
it belongs to 'input' group, and /dev/input/event* files are assigned to group 'input', with rw access for users belonging to that group.
I have changed your code to bypass ensure_root() , but even with this, I get this error:
Any clue?
The text was updated successfully, but these errors were encountered: