dev/shm noexec not sticking after reboot

I don't quite get what the problem is, I have added the following to fstab, running debian 6:

tmpfs  /dev/shm  tmpfs  defaults,nosuid,noexec,rw  0  0

And the options (mainly noexec) get applied if you remount /dev/shm.

But, and this is the odd bit, if I reboot my Linode, its like I havent even put the entry in, when you run mount. It just loads with default settings. If I remount, its fine.

Any help greatly appreciated.

Thanks.

6 Replies

Basically, without anything in fstab, dev/shm loads with:

nsuid,nodev,rw

But I want it to load with:

noexec,nosuid,nodev,rw

But its like its being ignored in fstab at boot.

I cant even find a config file which tells /dev/shm to load with those defaulkt settings.

Try this instead

/dev/shm    /dev/shm    tmpfs   noexec,nosuid,rw,nodev  0 0

@obs:

Try this instead

/dev/shm    /dev/shm    tmpfs   noexec,nosuid,rw,nodev  0 0

Thanks, I'll give this a try when I get in later and let you know how I get on.

ok I now get this:

/dev/xvda on / type ext3 (rw,noatime,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/shm on /dev/shm type tmpfs (rw,noexec,nosuid,nodev)

I did some digging through the innit scripts, and it seems that /dev/shm gets loaded by default before fstab is read, then after fstab is read, mtab is overwritten with defaults again.

So I have instead edited the defaults and mtab script so as to include noexec.

If anyone else has the same issue, Ill post up instructions

Hello,

I have met the same issue as yours. Could you post your instructions?

I am on Debian 6 (amd64), KVM virtualisation.

I have digged into /etc/init.d/mtab.sh, and now I have done to correct it.

nano /etc/init.d/mtab.sh

change from

domtab tmpfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT

into

domtab tmpfs /dev/shm tmpfs -onosuid,noexec,nodev$SHM_OPT

It works perfectly with Debian 6 amd64 / KVM box. I am not sure if it works on other systems/structures.

(Note that, I have edited $SHM_OPT in /etc/defaults/tmpfs, but it has not had affect after rebooting.)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct