1

i'm trying to write an udev rule to mount a specific partition of an usbkey as rw for the owner and no access for group and other user. This is my rule:

SUBSYSTEM=="block", KERNEL=="sdc1", MODE="0600" , GROUP="mygroup"

as far i know this rule should match the first partition of the sdc drive and mount the fs according to the octal permission 600 ( rw-------)

i ran also the command udevadm control --reload-rules but nothing is changed, my partition is mounted with 644

any hint?

0

1 Answer 1

3

I think this stems from a confusion:

my partition is mounted with 644

mounting and udev rules have little to nothing to do with each other. Udev sets the permissions on the block device /dev/sdc1, not the options on your mount. Different things!

I think you might not be using the right tool! Instead of udev, udisks is the tool to set the options for mounts.

http://storaged.org/doc/udisks2-api/2.9.2/mount_options.html documents how you can achieve what you want, probably.

Word of advise: it's a bad idea to use static partition names like sdc1 for this, since these can change if you have more than one USB stick; use UUIDs to begin with, everything else will sooner or later lead to confusion.

1
  • thanks Marcus, i came back to this topic today. As reported here storaged.org/doc/udisks2-api/latest/mount_options.html i can use udev to override some udisk settings, wich is what i want, any way i tried to use udisk without success, i added these line to /etc/udisks2/udisk2.conf [/dev/disk/by-label/MYKEY] vfat_defaults=uid=$UID,gid=$GID,noexec,umask=0077 but file and directory permission are still 644 Jun 27, 2021 at 17:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .