Use udev to setfacl when mounting a usb drive

Posted on 2015-05-31 in Trucs et astuces

Write the line below (and adapt it) in /etc/udev/rules.d/:

SUBSYSTEMS=="block",ACTION=="add",KERNEL=="sd?1",RUN+="/usr/bin/setfacl -m    u:apache:r-x /run/media/jenselme"

Attention: if the path of the command is not absolute, udev will search of it in /usr/lib/udev.