1

[Ubuntu 14.04.5 64bits]

I mount an SD card with rw permission, on /mnt/XYZ using a udev rule that also triggers a script using it as storage. If the SD card is not mounted, the script is inhibited.

Everything works well, except I'd like:

  • the card and its content to be owned not by root:root as is the case now, but by root:admin, (admin is a user group I create for certain admin tasks)
  • them to have ugo rwx permissions of type 640,
  • any folder created on the SD card to have the setgid bit.

When the SD is not mounted I can do as I please with the mount point: /mnt/XYZ has permissions drwxr-s---, and root:admin ownership, just as I want. As soon as I mount the SD card, things change:

  • the mount point becomes root:root and I cannot change it,
  • the content is also root:root and I cannot change it,
  • I cannot change content files' permissions either, as exemplified by :
    chown: changing ownership of ‘local.key’: Operation not permitted

Could it have something to do with format (MBR/FAT32) not allowing unix like permission attributes. Reformatting the SD card as NTFS does not help. I have not tries ext4. I have no trouble at all with managing permissions and/or attributes for files on ext4 SSD paritions mounted from fstab for instance.

Q: Is ext4 the only solution in this case ?

Cbhihe
  • 2,801
  • 3
  • 27
  • 47

0 Answers0