This is specifically on Ubuntu 20.04, but I believe the behavior is common:
Please take this fstab entry, creating a read-only mount:
/data/testDir/iso/ubuntu-20.04.4-live-server-amd64.iso /data/testDir/mnt iso9660 ro 0 0
Here is the related directory structure for that:
# ls -l /data/testDir/
drwxr-xr-x 2 root root 50 Apr 7 22:07 iso
drwxr-xr-x 1 root root 2048 Feb 23 2022 mnt
Everything mounts fine:
mount /data/testDir/mnt
works as expected.
However, upon a reboot, the permissions change on the mount point:
# ls -l /data/testDir/
drwxr-xr-x 2 root root 50 Apr 7 22:07 iso
dr-xr-xr-x 1 root root 2048 Feb 23 2022 mnt
This sort-of makes sense since it's a read-only mount, but it works either way, and this caused an unexpected failure in my CI/CD/Config mgmt system when the permissions changed to 0555 on that mnt directory after a reboot and that directory is managed. Ansible tried to change the permissions back to 0755 and failed since it's read-only.
Easy fix just setting 0555 from the start in config mgmt, but I have some questions about the behavior:
My questions:
- What exact mechanism is doing this?
- Is there a way to disable/control this behavior?