Ownership of a mount point

fstabmountpermissions

I cannot create files in my newly mounted partition . The folder to which i am mount the partition, /media/hrmount, is owned by root so even if I add a fstab line like

UUID=irrelevant /media/hrmount  ext4   defaults,user      0      2

/media/hrmount is still owned by root when i remount "irrelevant" .

And if i delete the directory in hope that "mount" will create it automatically and make it owned the user that issued the mount command I'll just get an error message saying the directory does not exist.

I could just use chown to make the directory owned by uid1000 but I understand it should not be needed plu I am positive that if i create another user, let's call him uid1001, then if we unmount the partition fs and then remount it as uid1001 it's mount point, /media/hrmount will still be owned by uid1000. This means I'll have to fiddle with permissions and while I can do that I have heard that just by adding the device to fstab like above should just work. How can I achieve that?

The ideal behaviour would be to just issue the mount device command either by sudoing or normally and the partition is mounted and also the folder is automatically created.

PS: I'm on Linux Mint 13

Best Answer

If a Linux filesystem (not e.g. FAT32, NTFS) is mounted then the directory permissions for the root directory are taken from the filesystem.

root must either change the owner (chown) or permissions (chmod, setfacl) of the root directory or has to create subdirectories which are writable by the users. The latter is what happens with the normal root volume: With the exception of tmp no standard directory is writable by users. The users can write to their directory below /home (and maybe to non-standard directories and subdirectories).

Related Question