I want to trigger a script when a USB is plugged in, I'm on Linux Mint 19.

The consensus appears to be to add a rule in /etc/udev/rules.d/my_rule.rules.

I tried several lines:

ACTION=="add", SUBSYSTEM=="usb", RUN+="/home/user/foo"


ACTION=="add", DRIVERS=="usb-storage", RUN+="/home/user/foo"


ACTION=="add", SUBSYSTEM=="block", RUN+="/home/user/foo"

And many others from the answers I found in SE. But none of them work. Of course /home/user/foo exists, is flagged as executable and, for the purpose of testing, is just:


Also I restart everytime udev service:

sudo /etc/init.d/udev restart

Am I missing something? Could be a hardware issue? Could be related to Mint?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.