How can I set device rw permissions permanently on Raspbian?

You can do this using udev. Create a file in /etc/udev/rules.d with the suffix .rules, e.g. local.rules, and add a line like this to it:

ACTION=="add", KERNEL=="i2c-[0-1]*", MODE="0666"

MODE=0666 is rw for owner, group, world. Something you can do instead of, or together with that, is to specify a GID for the node, e.g:

GROUP="pi"

If you use this instead of the MODE setting, the default, 0660 (rw for owner and group) will apply, but the group will be pi, so user pi will have rw permissions. You can also specify the OWNER the same way.

Pay attention to the difference between == and = above. The former is to test if something is true, the latter sets it. Don't mix those up by forgetting a = in ==.

You have to reboot for this to take effect.


"Writing udev rules" Reference