The kernel used to have a config option for whether to use ATIME or RELATIME; dunno if that also included some option for NOATIME. In any case, that's gone now.
I studied util-linux as well, to see if the mount command had configurable defaults or could be modified, but it did not appear to be the case.
However, it looks like you can patch the kernel to change the default behavior. Modify ./fs/namespace.c, around lines 2334:
long do_mount(...)
...
/* Default to relatime unless overriden */
if (!(flags & MS_NOATIME))
mnt_flags |= MNT_RELATIME;
...
Swap that around:
long do_mount(...)
...
/* Default to noatime unless overriden */
if (!(flags & MS_RELATIME))
mnt_flags |= MNT_NOATIME;
...
And that should do it.
The manual is correct. Your issue is that perhaps you didn't account for 3 important details:
users
(and user
) implies the options noexec
, nosuid
, and nodev
Unless overridden by subsequent options
Options order matters ;)
So when you use rw,nosuid,nodev,exec,users
in your fstab, the last option, users
, sets noexec,nosuid,nodev
, thus disabling your exec
(and also making your nosuid,nodev
redundant).
The result, as expected, is rw,noexec,nosuid,nodev
.
And no, users
was not ignored, it just doesn't usually show in mount
listing output. But any user can unmount it and mount it back again. Try it!
rodrigo@desktop ~ $ mount /dev/sda6 # ordinary user
rodrigo@desktop ~ $ mount | grep /dev/sda6
/dev/sda6 on /mnt/mint10 type ext4 (rw,noexec,nosuid,nodev)
rodrigo@desktop ~ $ /mnt/mint10/bin/echo it works # noexec will deny this
bash: /mnt/mint10/bin/echo: Permission denied
mount
will only show something related to user if user
(not users
) is used, and an ordinary, non-root user mounts it, like this:
rodrigo@desktop ~ $ mount /dev/sda6 # ordinary user
rodrigo@desktop ~ $ mount | grep /dev/sda6 # it will list current "owner"
/dev/sda6 on /mnt/mint10 type ext4 (rw,noexec,nosuid,nodev,user=rodrigo)
rodrigo@desktop ~ $ umount /dev/sda6
rodrigo@desktop ~ $ sudo mount /dev/sda6
rodrigo@desktop ~ $ mount | grep /dev/sda6 # since owner=root, it won't show
/dev/sda6 on /mnt/mint10 type ext4 (rw,noexec,nosuid,nodev)
rodrigo@desktop ~ $ umount /dev/sda6 # only mounter can unmount
umount: only root can unmount LABEL=MINT10 from /mnt/mint10
Also notice that, when using user
without noauto
, the partition will be automounted (by root) on boot. So until root unmounts it, no one will be able to unmount or (re-)mount.
That said, I guess you already figured out your solution: simply change the order of your options and everything will work fine:
LABEL=NewHome20G /media/NewHome20G ext3 users,exec 0 2
Notice how exec
is after users
. And also rw,nosuid,nodev
is not necessary. rw
is already a default, and the others are automatically turned on by users
And the result is:
rodrigo@desktop ~ $ mount /dev/sda6 # user mount
rodrigo@desktop ~ $ mount | grep /dev/sda6
/dev/sda6 on /mnt/mint10 type ext4 (rw,nosuid,nodev)
rodrigo@desktop ~ $ /mnt/mint10/bin/echo it works # exec works
it works
rodrigo@desktop ~ $ sudo umount /dev/sda6 # root unmount
rodrigo@desktop ~ $ sudo mount /dev/sda6 # root mount
rodrigo@desktop ~ $ mount | grep /dev/sda6
/dev/sda6 on /mnt/mint10 type ext4 (rw,nosuid,nodev)
rodrigo@desktop ~ $ umount /dev/sda6 # user unmount
rodrigo@desktop ~ $
Meaning any user, root or non-root, can mount and unmount it, regardless of who previously mounted or unmounted it. And executables works too :)
Best Answer
From
man mount
:Shows that
relatime
is an option for almost all filesystem mounted, but I can't say for sure if is a default for every filesystem that supportsatime
.