I have set the owner:group of the mount point to the user:group media:media and the desired permissions to drwxrwsr-x. However, after each reboot, they are reset to drwxr-xr-x and I need to set them again with chmod g+sw /srv to have the desired behavior. The owner of the mount point stays as I set it, though, so not everything is reverted.
How can I make the permissions stick as I have set them?
EDIT: I just tried removing the defaults from the fstab line. Doesn’t change behavior.
You are supposed to set owner/permissions for the root directory of the mount, which I did. At least this is what I thought is needed. I wouldn’t know how to debug this.
Sure enough, when I attempt to use mode=2775 in my /etc/fstab, do a sudo systemctl daemon-reload and try to mount, I get
emk2203@M4800:~$ LANG=C sudo mount -a
mount: /srv: fsconfig() failed: ext4: Unknown parameter 'mode'.
dmesg(1) may have more information after failed mount system call.
It reads and writes just fine, but with the wrong permissions. The owner and root can write without issues. The permissions get reset to the standard 755, where I want to have 2775 to have the same group also write permissions.
Yup, that’s the issue. There’s an umask getting applied since the empty mount point has the proper 2775 permissions. The umask reduces it back to default 755.
But where does it come from? I have no idea how to fix this, except for applying sudo chmod g+sw /srv directly after boot.
I do this as a workaround, but I am interested to know why this happens.
Again I’m not completely sure about this, but try adding umask=007 to your mount options. This should allow user and group to read and write but give others no access. That is if it works at all!
Hmm, I’m sure I remember umask. Maybe that was ext3 or something. The only other thing I can think of is you are chaning the permissions on the actual directory (not the files inside it) after the file system is mounted?