I am making a small linux module that is a driver to a char device. In my code i create the device class, than the device it self and thus a /dev file is created in my system. the problem is that the /dev file has only root permissions and the user has neither read nor write nor execute permissions on that file, i would like to change the /dev file permissions.
I have searched the web for answers and what i found was to change the udev file, but this solution will not work in my case because i need the permissions to change dynamicly when the module is loaded into the kernel. The module i am writing will not always run on my machine, thus i need it to change the permissions "on the fly".
major_number_firewall = register_chrdev(0, device_name_firewall, &my_file_implementation_firewall);
device_class = class_create(THIS_MODULE, class_name_firewall);
log_file_device = device_create(device_class, NULL, MKDEV(major_number_firewall, MINOR_LOG), NULL, device_name_log_file);
Is there a function for changing the permissions?