What permissions should a udev rule have

udev

What permissions should a udev rule have for a USB device? 644? 755?

For example on Ubuntu I'm looking at this file: /etc/udev/rules.d/99-lpcscrypt.rules

Best Answer

There's no reason to make a udev rule executable. They aren't executable (the kernel wouldn't do anything with them) and udev doesn't attach a special meaning to executable rule files.

A udev rule must not be writable to non-root user. A user who modifies it could inject arbitrary code that is run as root.

Udev rules don't normally contain anything confidential. Pretty much any information that's there can be revealed through /sys interfaces, /dev entries, ps calls while a RUN directive is running, etc.

So the right permissions are 644.

Related Question