LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   change file permission of a mouse device file permanently (https://www.linuxquestions.org/questions/linux-general-1/change-file-permission-of-a-mouse-device-file-permanently-511627/)

alexandre_fs 12-18-2006 10:34 AM

change file permission of a mouse device file permanently
 
hello.

i am developping an application that needs to poll/read the device file: /dev/input/mouse0

i belong to a group that has no permission to read this file, so i use the following command:

sudo chgrp alexandre /dev/input/mouse0

(alexandre is the group that i belong...)

now, the problem is that when i restart the computer, or disconnect and reconnect again the mouse, it resets the permissions to default.

how can i permanently change the access permission to this kind of device files?

i am using kubuntu 6.06 with the latest kernel.

also, i checked for udev and devfs and they both seemed to be installed. (at least there are configuration files in /etc/udev and /etc/devfs

i am guessing i could change the permission rules in udev, but i can't find where it refers to mouse devices.

thank you for your attention,

Alexandre

stress_junkie 12-18-2006 11:34 AM

You could add the mouse group as a secondary user group to your user account.

usermod -G mouse,video,disk,whatever alexandre

Or you could use the udev startup script to establish device permissions for the mouse device during system startup.

alexandre_fs 12-20-2006 07:33 AM

thanks for your answer.

maybe it's better to modify the udev script, since the group that has permission to read the device files is by default only 'root'.

i've been checking some sites for doing this and i can't find a simple guide to just change this simple aspect. (make the mouse devices files readable to every user...)

i'm guessing that this should be quite direct. can you give me a hint on how to do this?


thank you

nx5000 12-20-2006 08:20 AM

With udev, it should be something like this:

edit /etc/udev/permissions.rules and go to input devices, modify the line containing KERNEL=="mouse[0-9]*"
If it doesn't exist, add it :

Quote:

KERNEL=="mouse[0-9]*", MODE="0664"
Do not put it after LABEL="permissions_end"

And you need to reboot

alexandre_fs 12-25-2006 02:50 PM

ok thanks nx5000

i will give it a try and post here the result, as soon as possible.

alexandre

alexandre_fs 01-09-2007 06:30 AM

i edited the file 40-permission.rules like u suggested, and added that line.
i could not find any LABEL saying "permissions_end" so i inserted in the end of the file.

everything is OK now :)
i can now read mouse device files by default.

thank you for your help!!


All times are GMT -5. The time now is 01:41 AM.