How to determine full mount options for a mounted file system ?
If
defaults
provides an alias for
async,auto,dev,exec,nouser,rw,suid
, then why these options not reported in
/etc/mtab
,
/proc/mounts
or in
mount
command ?
If the filesystem is mounted with one of the option in
defaults
, do other options are applicable ?
For example,
/etc/fstab
lists
tmpfs
filesystem as below :
tmpfs /dev/shm tmpfs defaults 0 0
However, mount command and /proc/mounts reports only rw from defaults :
# mount -v -t tmpfs
tmpfs on /dev/shm type tmpfs (rw)
[2] Now, edit fstab to mount tmpfs with rw,noexec and performed a reboot :
# cat /etc/fstab | grep tmpfs
tmpfs /dev/shm tmpfs rw,noexec 0 0
# cd /dev/shm/
# cat > script.sh
#!/bin/bash
echo "Script ran"
# ls -l
total 4
-rw-r--r--. 1 root root 30 Apr 6 00:47 scripts.sh
# chmod u+x script.sh
chmod: cannot access `script.sh': No such file or directory
Result : Unable to set execute permission, as noexec is set explicitly.
For example, mounting a filesystem with rw,exec options, will also mount the filesystem with suid,dev,auto,nouser,async,relatime.
But, if any of these option is unset explicitly, it will not be applicable.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Here are the common uses of Markdown.
Code blocks
~~~
Code surrounded in tildes is easier to read
Links/URLs
[Red Hat Customer Portal](https://access.redhat.com)
Learn more
Are you sure you want to update a translation?
It seems an existing English Translation exists already.
We appreciate your interest in having Red Hat content localized to your language. Please note that excessive use of this feature could cause delays in getting specific content you are interested in translated.