/tmp mounting options as tmpfs: Compatibility & Security
5
votes
2
answers
8333
views
Having a SSD - it is recommended to mount
/tmp
as tmpfs
.
Examples:
- https://askubuntu.com/questions/550589/best-way-to-mount-tmp-in-fstab
- https://yktoo.com/en/blog/post/233
- https://askubuntu.com/questions/173094/how-can-i-use-ram-storage-for-the-tmp-directory-and-how-to-set-a-maximum-amount
The mounting options are different in each example - why???
The default Ubuntu 16 installation sets the mounting options for root (/
) as (from /etc/mtab
):
/dev/sda1 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
Ergo all other options - as suggested in the examples/links - shouldn't be applied.
Some of the mounting options in the various examples on the web are:
defaults,noatime,mode=1777
or:
defaults,noatime,nosuid,nodev,noexec,mode=1777,size=512M
But:
- Having noatime
feels useless because that the data is stored in RAM which is fast anyway.
- Why nosuid,nodev,noexec
?
How do they know whether softwares are dependent on certain options or not?
---
I think it is best to stick with the default permissions that the installation applied, meaning:
rw,relatime,mode=1777,uid=0,gid=0
In order to ensure proper operation of various softwares:
- The permissions are 1777 because that the default permissions for /tmp
are also drwxrwxrwt
(see stat -c "%a %n" /tmp
).
- The uid
and gid
are root
because that /tmp
has the same.
Is there something which I'm missing here?
Asked by Dor
(2635 rep)
Mar 18, 2017, 01:45 PM
Last activity: May 29, 2025, 05:01 AM
Last activity: May 29, 2025, 05:01 AM