1

Having a SSD - it is recommended to mount /tmp as tmpfs.

Examples:

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?

3
  • 2
    drwxrwxrwt is 1777, not 0776. It's admittedly a little confusing because ls fits 12 permission bits into 9 character positions. – Mark Plotnick Mar 18 '17 at 18:51
  • @MarkPlotnick True. The documentation for that isn't good. I've seen this source. Is there a difference between 1776 and 1777 ? – Dor Mar 19 '17 at 8:00
  • 1776 doesn't have x permission for other. That's not good for a public directory like /tmp - it would mean users who aren't root and aren't in group 0 cannot access any file in /tmp. – Mark Plotnick Mar 19 '17 at 10:12
0

Before systemd, the standard way to activate tmpfs on /tmp was to activate it in /etc/default/tmpfs and set RAMTMP=yes (even if almost everyone was editing /etc/fstab). This way you can see what are the default options. On my Devuan Ascii the mounting options are:

$ mount -l | grep "/tmp"
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime,size=3293980k)

size defaults to 20% physical memory + swap.

So I guess you could not go wrong using the same options in /etc/fstab.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.