0

I want to define a udev rule for a particular block device (or partition). I currently do it by defining a 91-my-custom-rules.rules configuration file as follows:

computer:/etc/udev/rules.d # cat 91-my-custom-rules.rules 
KERNEL=="sdc2", OWNER="username", GROUP="users", MODE="0600"

The above example changes the ownership of /dev/sdc2 to username:users and sets its permissions to 0600.

For obvious reasons, /dev/sdc2 might not always point to the exact same device/partition. Therefore, I'd like to define a rule for a disk by id or uuid instead. How can I do this?

  • Other than using the other attributes of the device? – Ignacio Vazquez-Abrams Jun 1 '18 at 15:07
  • @IgnacioVazquez-Abrams As long as I can reliably filter for the right device, I do not care how it it's done. I thought disk ids or uuids make most sense, though. – s-m-e Jun 1 '18 at 15:08
  • Try matching on ENV{ID_FS_UUID} – meuh Jun 1 '18 at 15:33

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.