Skip to main content
Topic: tmpfs Question (Read 294 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

tmpfs Question

Hello, guys

I need to mount /tmp and /dev/shm with noexec option permanenty.

mount tells me this:

Code: [Select]
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=401792k,nr_inodes=100448,mode=700,uid=1000,gid=1001,inode64)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,relatime,inode64)

What do I do? Do I have to simply add something like this to my fstab:

Code: [Select]
tmpfs    /tmp      tmpfs defaults,noatime,noexec            0 0

?

Re: tmpfs Question

Reply #1
Well noexec is the mount option you want.

But using 'defaults' is not what you want.
From the man page:
Quote
defaults
           Use the default options: rw, suid, dev, exec, auto, nouser,
           and async.
Which contradicts several of the settings listed by mount ,nosuid,nodev and the noexec that you are adding. I'm not sure what would end up with precedence ?

Also if there is already an entry in fstab for /tmp you want to edit that not add another.

This is mine
Code: [Select]
tmpfs /tmp  tmpfs nodev,noexec,nosuid,size=16G  0 0
which results in
Quote
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,relatime,size=16777216k,inode64)

I have no fstab entry for /dev/shm and get
Quote
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,inode64)