Disabling shared memory prevents ssh login

Geuis asked:

I’m setting up a new Linode server and following steps from here: https://help.ubuntu.com/community/StricterDefaults

2 times now if I follow the following steps:

Edit /etc/fstab
Add this line: 
    tmpfs     /dev/shm     tmpfs     defaults,ro     0     0

After reboot I’m no longer able to ssh into the server.

In /etc/fstab, its indicated in the format comment that the file path should be the first option. “tmpfs” is before that. Could this be a typo in the documentation?

My answer:

First, the syntax as given is correct. The line in /etc/fstab is supposed to begin with tmpfs. Note that the way you posted it, it begins with spaces, which should not be there.

Second, the page you linked to did warn you:

Note: MANY programs will not work if you make /dev/shm read-only (e.g. Google Chrome).

If you’re trying to secure /dev/shm then that’s going too far. Try just noexec,nosuid instead.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.