What determines permissions in /dev?
Solution 1:
A more flexible way to manage permission on files is to use ACL.
sudo setfacl -m u:popey:rw /dev/input/eventx
If you really need to make this permanent then you can use an udev rules that set it for your event input device
add a file /etc/udev/rules.d/99-userdev-input.rules with:
KERNEL=="event*", SUBSYSTEM=="input", RUN+="/usr/bin/setfacl -m u:popey:rw $env{DEVNAME}"
you can check the ACLs permission with
getfacl /dev/input/event*
Solution 2:
I don't know what initially sets the permissions of the character devices /dev/input/event*
but, I do know you can change those permissions with a software which is on your system by default as part of coreutils. see the command man mknod
.
The permissions of my event devices are:
crw-rw---- 1 root input 13, 64 Apr 14 06:39 /dev/input/event0
here are some usage examples:
~$ sudo mknod lolwat c 4 64
~$ sudo mknod lolwatnow c 4 64 -m 777
~$ ls -l lolwat*
crw-r--r-- 1 root root 4, 64 Apr 14 08:07 lolwat
crwxrwxrwx 1 root root 4, 64 Apr 14 08:08 lolwatnow
if you need more info about for deciding on major and minor numbers, look here
Now, you say the permissions are wrong. So something must be setting them wrong, and that thing, must run as root. mknod could be used to create an device, but mkdev could also. you may want to look at the permissions of whatever the default actions are for mkdev, and mknod.
As in my examples: /dev/input/event0 has crw-rw permissions, but the default permissions, of lolwat were set to crw-r--r--
I have some uncertainty, whether type of device dictates original permissions.You can experiment with this to find out.
Here is another link for more info about mknod
Solution 3:
Basically, you'd need to add a file in /etc/udev/rules.d/
(you could name it something like 75-input-events.conf
)
And add lines KERNEL=="eventX" , SUBSYSTEM=="input", MODE="0777"
for each event into that file, where x is the number. For instance, I have events 0 through 9, so I personally would do for each one of them. Last answer on this thread suggest you could have added KERNEL==event*
(i.e., with wild card),too.