Is there a way to read from /dev/input devices, without needing 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 the signal comes from), so simply using stdin is not possible.

Always having to call the program with sudo-privileges would not be too elegant - is it, for example, possible to chmod the /dev/input directory (security does not matter in my case)?

Or, even better, is there another way of directly reading from input devices?

  • 2
    It is possible to chmod devices in /dev/input/ using a udev rule. This is generally the best option for chmoding devices as it handles them being removed/added.
    – Centimane
    Nov 10, 2015 at 20:54

1 Answer 1


This stack overflow article seems to answer your question.

See the second answer. The accepted answer is:

Check to see to which group the device files belong to. For example, here I get:

$ ls -l /dev/input/
crw-rw---- 1 root plugdev 13, 64 Nov  4 18:01 event0
crw-rw---- 1 root plugdev 13, 65 Nov  4 18:01 event1
crw-rw---- 1 root plugdev 13, 66 Nov  4 18:01 event2
crw-rw---- 1 root plugdev 13, 67 Nov  4 18:01 event3
crw-rw---- 1 root plugdev 13, 68 Nov  4 18:01 event4

The user executing your program needs to be in the plugdev group on this system. Something similar is probably the case on your system.

If you're asking for a way to circumvent that (reading or writing to the device without being in the group), then no. That would obviously defeat the purpose of security though user groups.

An alternative to reading the event devices directly would be to use an appropriate user space API instead. For example, to read the keyboard you would use ncurses, and to read the mouse you would use GPM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy