5

I have my code that will run every time udev detects new usb.

My code works fine when I run it as a local user.

But It fails when I use udev.rules file because it runs my script as root.

How can I run ".rules" as a local user?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Bonn
  • 183
  • 14
  • You probably want to trigger a systemd service from udev. It will handle many things for you like user switching. Have a look here for a full example of using udev with systemd : https://serverfault.com/questions/766506/automount-usb-drives-with-systemd/767079 – JulienCC Apr 01 '21 at 21:02

0 Answers0