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,761
  • 3
  • 24
  • 47
  • 3
    ^same issue and solution for FAT32 (except for the POSIX permission support of NTFS). I doubt you can get setgid to work on FAT32, not that it will matter, since everything will have the ownership and mode set by the mount options. Best use ext4 if you need more fine-grained permission controls. – muru Apr 18 '17 at 07:24
  • Yes, thanks @muru solution is either ntfs-3g.usermap (per your referenced link in 1st comment) or ext4. Mods: Sorry about the dupe. Should I just delete the question ? – Cbhihe Apr 18 '17 at 07:46
  • Keep the question, mark as a duplicate (useful for searching) – muru Apr 18 '17 at 07:59

0 Answers0