My SSD Partitions are mounting as noexec, in defiance of fstab
I'm on 18.04, and my SSD partitions are mounting as "noexec" despite that "exec" is explicitly stated in fstab. This is happening both with NTFS and EXT4 partitions.
My FStab entries:
LABEL=Speedy /media/dmh/Speedy ext4 rw,nodev,relatime,suid,exec,auto,user,async 0 0
UUID=4A1CA3E81CA3CD6F /media/dmh/Gaming ntfs rw,nodev,relatime,rw,suid,exec,auto,user,async,allow_other,blksize=4096 0 0
But findmnt reports:
$ findmnt /media/dmh/Speedy TARGET SOURCE FSTYPE OPTIONS /media/dmh/Speedy /dev/nvme0n1p2 ext4 rw,nosuid,nodev,noexec,relatime,data=ordered
$ findmnt /media/dmh/Gaming TARGET SOURCE FSTYPE OPTIONS /media/dmh/Gaming /dev/nvme0n1p3 fuseblk rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,allow_o
At this point I'm kinda stumped. Both of these do mount -- After converting to EXT4, I had to remove Speedy's "allow_others" tag to make it mount.
ETA: Steeldriver's tip was in fact the key, and now my drives are mounting with proper flags.
Solution 1:
The order in which the options are specified is significant. From man mount
:
user Allow an ordinary user to mount the filesystem. The name of the
mounting user is written to the mtab file (or to the private
libmount file in /run/mount on systems without a regular mtab)
so that this same user can unmount the filesystem again. This
option implies the options noexec, nosuid, and nodev (unless
overridden by subsequent options, as in the option line
user,exec,dev,suid).
So, if you want to use both user
and exec
, the latter must come after the former so that the implied noexec
of user
is overridden by an explicit exec
.