x-systemd.automount and noauto causes CIFS mount to ignore uid/gid and mount as root
0
votes
1
answer
108
views
I'm trying to mount a CIFS (Samba) share using /etc/fstab, and I want it to be owned by a specific user (myuser), not root.
My current fstab line is:
#
//server/share /mnt/share cifs credentials=/home/myuser/.smbcred,uid=myuser,gid=myuser,noauto,x-systemd.automount 0 0
However, when I include x-systemd.automount and noauto, the mount happens as root, and the uid/gid options appear to be ignored. Here's what I see after accessing the mount point:
$ ls -lah /mnt/share
drwxrwx--- 1 root root 0 ...
-rw-rw---- 1 root root ...
But if I remove x-systemd.automount and noauto and mount the share mount manually, the ownership is correct:
$ ls -lah /mnt/share
drwxrwx--- 1 myuser myuser 0 ...
-rw-rw---- 1 myuser myuser ...
So it seems that using x-systemd.automount causes the mount to be performed by root, ignoring uid and gid.
Is this expected behavior? Is there a way to use automounting and still preserve the correct ownership?
I'm on the regular 6.14.4-arch1-1 kernel with systemd and cifs-utils.
Asked by NLion74
(1 rep)
May 4, 2025, 04:30 PM
Last activity: May 4, 2025, 06:09 PM
Last activity: May 4, 2025, 06:09 PM