Package: mount
Version: 2.33.1-0.1
Let me say in advance that I don't know if this is really a problem of mount,
libmount1, the kernel or something else. The libmount1 version is the same as
mount; the kernel package is linux-image-4.19.0-11-amd64 version 4.19.146-1.
When having an /etc/fstab entry with the `user` flag and issuing a command like
`mount -r <dir>` as a non-root user, the filesystem is mounted read-write
instead of read-only, without issuing any error or warning. This behaviour has the
potential of data loss in some scenarios.
For example, my /etc/fstab contains this line:
/dev/sdd1 /media/sdd1 auto user,noauto,exec,nodev 0 0
If I type `mount -r /media/sdd1` with a non-root user, the filesystem is
mounted without any error or output, but the `-r` flag has no effect, as
/proc/mounts demonstrates. On the other hand, when I type `mount -o ro
/media/sdd1` I get an error message:
mount: only root can use "--options" option
Tested with USB drives having ext4 and FAT filesystems, as well as with tmpfs.
For example, I can reproduce it with this /etc/fstab line:
tmpfs /media/tmp tmpfs user,noauto 0 0
Tested in a buster VM instance. This problem can also be reproduced in the
host, which is running stretch (oldstable as of this writing) and in a
different machine running jessie (oldoldstable), but not in wheezy. In wheezy,
the read-only flag is honoured. The wheezy machine is running in 32 bits, if
that matters.