keyboard linux with no-root user, but in "input" group
See original GitHub issueIts 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…
pi@rpi4:/ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev lpadmin gpio i2c spi
pi@rpi4:/ $ ls -la /dev/input/event1
crw-rw---- 1 root input 13, 65 nov 24 20:44
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:
python3 -m keyboard
/home/pi/.local/lib/python3.7/site-packages/keyboard/_nixkeyboard.py:110: UserWarning: Failed to create a device file using `uinput` module. Sending of events may be limited or unavailable depending on plugged-in devices.
device = aggregate_devices('kbd')
Couldn't get a file descriptor referring to the console
Any clue?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Read from /dev/input devices without root privileges
In my case, I would like to use the Python library evdev to read from multiple keyboards (so that I know which keyboard...
Read more >How to Create a Non-root User on Your Server - HostAdvice
This guide shows you how to create a non-root user on your Ubuntu 18.04 virtual or dedicated server.
Read more >Keyboard - Debian Wiki
To configure the keyboard for Linux kernel and X, you have to install keyboard-configuration. The package console-setup is also needed. The ...
Read more >Linux raw input without root permission? - Stack Overflow
Note: you will probably need to create the group "input" first. ... For example, to read the keyboard you would use ncurses, and...
Read more >Having Steam installed gives your user read-write access to ...
Ask yourself how KDEconnect/GSConnect works for mouse/keyboard emulation from your phone. But is there anything wrong with providing input- ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I actually figured this out. comment out the two calls to
ensure_sudo()
and place this content intocontent:
I am not sure of the security implications of allowing
0666
w+r for everyone on those devices. I would think that doing that will allow anyone (in a multiuser env) to “listen” to keystrokes from other users… so be careful with this.I can run “pressed_keys.py” just fine on Linux Mint 20.2, adding tty and input groups. Just a typo, at _nixkeyboard.py line 76 warning; change “useradd” to “usermod”. Can the same be done on boppreh/mouse library?