Re: Custom udev rules to override defaults?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Tue, 2009-07-14 at 17:52 +0100, James Pearson wrote:
> I'm trying to work out how to set up a custom udev rule to override 
> permissions on serial ports (/dev/ttyS* and /dev/ttyUSB*) on CentOS 5.3
> 
> The default rule, in /etc/udev/rules.d/50-udev.rules has the line:
> 
> KERNEL=="tty[A-Z]*",            NAME="%k", GROUP="uucp", MODE="0660"
> 
> and I would like the mode to be 0666
> 
> Various docs on web say that you shouldn't change 50-udev.rules, but 
> instead create a new rule file that appears lexically before that rule - 
> so I've created a file that contains the line:
> 
> KERNEL=="tty[A-Z]*",            NAME="%k", GROUP="uucp", MODE="0666"
> 
> called 10-local.rules
> 
> However, this doesn't work ... the /dev/ttyS* device files get the 
> 'default' owner/group/perms (mode = '0600', uid = '0', gid = '0')
> 
> If I rename the 10-local.rules to say 99-local.rules, then the device 
> files get the owner/group/perms from 50-udev.rules (mode = '0660', uid = 
> '0', gid = '14')
> 
> I can get the mode set to 0666 by editing 50-udev.rules, however this 
> seems wrong as you should be able to override the defaults without doing 
> this.
> 
> Anyone know if this is possible?

It seems like it should be.  I presume that you have already been
reading the rules guide found on your system
at /usr/share/doc/udev-095/writing_udev_rules/index.html.  I can't add
much to that, except to point out that to support various models of UPS
on different systems, I have put the following into a file
named /etc/udev/rules.d/99-nut-ups.rules and gotten the desired results:

#  Serial device for UPS monitoring
KERNEL=="ttyS0",            OWNER="nutdev", GROUP="nut", MODE="0660"
KERNEL=="hiddev0",            OWNER="nutdev", GROUP="nut", MODE="0660"

As you will note, these lines change the user and group ownership of the
target files, but the permissions via the "MODE" parameter should work
the same way.

I'm wondering if you might want to try a more selective target for the
device in the "KERNEL" parameter, say "ttyS*" since you're targeting
your serial ports.

> 
> Thanks
> 
> James Pearson
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos
-- 
Ron Loftin                      reloftin@xxxxxxxxxxxx

"God, root, what is difference ?"       Piter from UserFriendly

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux