# Provide user, group, and mode information for devices. If a regex matches # the device name provided by sysfs, use the appropriate user:group and mode # instead of the default 0:0 660. # # Syntax: # [-]devicename_regex user:group mode [>|=path] [@|$|*cmd args...] # [-]$varname=regex user:group mode [>|=path] [@|$|*cmd args...] # [-]subsystem/regex user:group mode [>|=path] [@|$|*cmd args...] # [-]@major,minor[-minor2] user:group mode [>|=path] [@|$|*cmd args...] # # Leading minus in 1st field means "don't stop on this line", otherwise # search is stopped after the first match. # default is 0:0 660. user, group can be names (no nss!) or numeric. # # =: move, >: move and create a symlink from match to new name # if lhs is regex: %1..%9 are backrefs to captures # !: don't create node (but run scripts) # @|$|*: run $cmd on delete, @cmd on create, *cmd on both AND on change # cmd also gets $SUBSYSTEM and $MDEV # for debugging # -.* root:root 0666 *{ date; set; echo; } >>/tmp/log # per-machine specifics sr([0-9]+) root:cdrom 0660 >scd%1 @/bin/ln -sf "$MDEV" cdrom; /bin/ln -sf "$MDEV" dvd hda root:cdrom 0660 @/bin/ln -sf "$MDEV" cdrom; /bin/ln -sf "$MDEV" dvd # generic $DEVNAME=bus/usb/([0-9]+)/([0-9]+) root:plugdev 0660 =bus/usb/%1/%2 -block/.* root:disk 660 */etc/mdev/diskidlinks "$MDEV" block/sd.* root:disk 660 */etc/mdev/block.agent bluetooth/.* root:root 0660 */etc/mdev/bluetooth.agent rfkill.* root:root 0660 */etc/mdev/rfkill.agent # support module loading on hotplug $MODALIAS=.* root:root 660 @/sbin/modprobe -b "$MODALIAS" # null may already exist; therefore ownership has to be changed with command null root:root 666 @/bin/chmod 666 "$MDEV" zero root:root 666 full root:root 666 random root:root 666 urandom root:root 666 hwrandom root:root 666 kmem root:kmem 640 kmsg root:root 600 mem root:kmem 640 port root:kmem 640 # console may already exist; therefore ownership has to be changed with command console root:tty 600 @/bin/chmod 600 "$MDEV" ptmx root:tty 666 pty.* root:tty 666 tty[a-z][0-9a-f] root:tty 666 cpu([0-9]+) root:root 600 =cpu/%1/cpuid msr([0-9]+) root:root 600 =cpu/%1/msr microcode root:root 600 =cpu/ # Typical devices tty root:tty 666 tty[0-9] root:tty 620 vcsa?[0-9]* root:tty 620 ttyS[0-9]+ root:dialout 660 # block devices ram[0-9]+ root:disk 660 loop[0-9]+ root:disk 660 sd[a-z].* root:disk 660 hd[a-z].* root:disk 660 md[0-9]+ root:disk 660 sr([0-9]+) root:cdrom 660 >scd%1 bsg/.* root:root 600 =bsg/ # packet writing for cd/dvd pktcdvd([0-9]+) root:cdrom 660 =pktcdvd/%1 pktcdvd root:cdrom 660 =pktcdvd/control # net and misc tun[0-9]* root:uml-net 660 =net/ tap[0-9]* root:uml-net 660 =net/ i2c-([0-9]+) root:root 600 >i2c/%1 i2c([0-9]+) root:root 600 >i2c/%1 card[0-9] root:video 660 =dri/ rtc0 root:root 600 @/bin/ln -sf $MDEV rtc fuse root:fuse 660 device-mapper root:root 600 >mapper/control # alsa sound devices and audio stuff pcm.* root:audio 660 =snd/ control.* root:audio 660 =snd/ midi.* root:audio 660 =snd/ seq root:audio 660 =snd/ timer root:audio 660 =snd/ adsp root:audio 660 audio root:audio 660 dsp root:audio 660 mixer root:audio 660 sequencer.* root:audio 660 # v4l stuff video[0-9]+ root:video 660 # input stuff event[0-9]+ root:root 660 =input/ mice root:root 660 =input/ mouse[0-9]+ root:root 660 =input/ ts[0-9] root:root 660 =input/ js[0-9] root:plugdev 660 >input/ ttyUSB[0-9]+ root:dialout 660 ttyACM[0-9]+ root:plugdev 660