Is this a good line for mounting /tmp at tmpfs?

Is the following a good/correct line to put in fstab?

tmpfs /tmp tmpfs rw,noexec,nodev,nosuid,uid=user,gid=group,mode=1700 0 0

/tmp is mounted on tmpfs by default. You shouldn’t need a line in fstab for it.

You can see this with:

mount | grep /tmp

That being said, if you want to do it like that you need to specify a user/uid for user and a gid/group for group

Also, are you sure you want to set /tmp as noexec? Anything that writes a script to /tmp will probably stop working.

Setting mode 1700 on /tmp also seems like a bad plan.

Keep in mind that example line in the Arch wiki isn’t for /tmp


Looks like I got it all wrong.
I missed the part that systemd mounts /tmp as tmpfs via tmp.mount unit.

mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,size=7901032k,nr_inodes=409600,inode64)

Thanks for clearing things up @dalto!

1 Like