AutoFS Mount Ownership Changes
Issue
A direct AutoFS map has the desired user and group ownerships when it is active (mounted), but the wrong ownerships when inactive (unmounted).
Example
A direct AutoFS map has been setup under /autofs_controlled
; it is /autofs_controlled/special_mnt_point
. That mount point is for a file system owned by spuser:spgroup
.
When the mount is active, the ownership is correct. When the mount is inactive, the ownership is root:root
.
-
Show what the system looks like before AutoFS is started.
# ls -aFl /autofs_controlled total 2 drwxr-xr-x. 4 root root 48 Aug 31 08:52 ./ dr-xr-xr-x. 21 root root 4096 Aug 31 09:01 ../
-
Start AutoFS and see that the direct map mount point has the wrong ownerships.
# systemctl start autofs.service # ls -aFl /autofs_controlled total 3 drwxr-xr-x. 4 root root 48 Aug 31 08:52 ./ dr-xr-xr-x. 21 root root 4096 Aug 31 09:01 ../ drwxr-xr-x. 2 root root 0 Aug 31 09:01 special_mnt_point/
-
List the contents of the mount point to trigger AutoFS into mounting it.
# ls -aFl /autofs_controlled/special_mnt_point total 0 drwxr-xr-x. 2 spuser spgroup 18 Aug 31 07:05 ./ drwxr-xr-x. 4 root root 48 Aug 31 08:52 ../ -rw-r--r--. 1 spuser spgroup 0 Aug 31 07:05 testfile
-
Note the ownership of the mount point has changed to the desired ownerships.
# ls -aFl /autofs_controlled total 3 drwxr-xr-x. 4 root root 48 Aug 31 08:52 ./ dr-xr-xr-x. 21 root root 4096 Aug 31 09:01 ../ drwxr-xr-x. 2 spuser spgroup 18 Aug 31 07:05 special_mnt_point/
One can change the ownerships after AutoFS is started (chown spuser:spgroup /autofs_controlled/special_mnt_point
), but those ownerships do not survive a restart of the AutoFS service.
Environment
- Red Hat Enterprise Linux 7 (RHEL 7)
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.