What are the default mount settings for mount / fstab?
Posted
by
John Craick
on Ask Ubuntu
See other posts from Ask Ubuntu
or by John Craick
Published on 2012-08-31T15:38:09Z
Indexed on
2012/08/31
15:52 UTC
Read the original article
Hit count: 355
What are the default mounting options for a non root partition ?
The man entry for mount says ...
defaults - use default options: rw, suid, dev, exec, auto, nouser, and async.
... so that might be what we expect to see. But, unless I'm missing something, that's not what happens.
I have an ext3 partition labelled "NewHome20G" which is seen as /dev/sdc6 by the system. This we can see from ...
root@john-pc1204:~# blkid | grep NewHome20G
/dev/sdc6: LABEL="NewHome20G" UUID="d024bad5-906c-46c0-b7d4-812daf2c9628" TYPE="ext3"
I have an entry in fstab as follows ...
root@john-pc1204:~# cat /etc/fstab | grep NewHome
LABEL=NewHome20G /media/NewHome20G ext3 rw,nosuid,nodev,exec,users 0 2
Note the option settings that are specified in that fstab line.
Now I look at how the partition is actually mounted after boot up ...
root@john-pc1204:~# mount -l | grep sdc6
/dev/sdc6 on /media/NewHome20G type ext3 (rw,noexec,nosuid,nodev) [NewHome20G]
... so, when the filesystem gets mounted the exec & users options I specified seem to have been ignored.
Just to be sure, I unmount sdc6, remount it and look at the mount options again ...
root@john-pc1204:~# umount /dev/sdc6
root@john-pc1204:~# mount /dev/sdc6
root@john-pc1204:~# mount -l | grep sdc6
/dev/sdc6 on /media/NewHome20G type ext3 (rw,noexec,nosuid,nodev) [NewHome20G]
.... same result
Now I unmount the partition again, remount it specifying the exec option and look at the result ...
root@john-pc1204:~# umount /dev/sdc6
root@john-pc1204:~# mount /dev/sdc6 -o exec
root@john-pc1204:~# mount -l | grep sdc6
/dev/sdc6 on /media/NewHome20G type ext3 (rw,nosuid,nodev) [NewHome20G]
... and here the exec option has finally taken effect and the noexec setting has vanished.
Just for interest, I re-mount the partition with the defaults option
root@john-pc1204:~# umount /dev/sdc6
root@john-pc1204:~# mount /dev/sdc6 -o defaults
root@john-pc1204:~# mount -l | grep sdc6
/dev/sdc6 on /media/NewHome20G type ext3 (rw,noexec,nosuid,nodev) [NewHome20G]
The noexec is back, so it looks very like rw,noexec,nosuid,nodev are the default options which is NOT what man says.
Why does this matter ?
I have a folder full of useful scripts stored on a data disk. Because that disk is mounted noexec those scripts won't run, even though they have all been set with chmod 777. I can work round this in several ways but it's disappointing that the man entry seems to be wrong.
Have I missed something obvious here or have the default options in Ubuntu changed from what they were a few versions ago ?
© Ask Ubuntu or respective owner