{"id":275,"date":"2009-11-06T18:06:52","date_gmt":"2009-11-06T22:06:52","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=275"},"modified":"2013-03-20T08:41:10","modified_gmt":"2013-03-20T12:41:10","slug":"howto-secure-tmp-and-devshm","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/howto-secure-tmp-and-devshm","title":{"rendered":"Howto: Secure \/tmp and \/dev\/shm partitions"},"content":{"rendered":"<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>How to secure \/tmp and \/dev\/shm partitions?<\/strong><\/span><\/pre>\n<\/blockquote>\n<p>It is highly recommended to <strong>mount \/tmp and \/dev\/shm partitions in noexec,nosuid mode<\/strong> in order to prevent files been executed under those partitions. To mount \/tmp and \/dev\/shm in noexec,nosuid more, edit the <strong> \/etc\/fstab<\/strong> file and<\/p>\n<p>search for the word<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>\"defaults\" <\/strong><\/span><\/pre>\n<\/blockquote>\n<p>in front of the 2 partitions and replace them with<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>rw,noexec,nosuid<\/strong><\/span><\/pre>\n<\/blockquote>\n<p>The entry should look like the following:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>tmpfs \/dev\/shm  tmpfs   rw,noexec,nosuid  0 0<\/strong><\/span><\/pre>\n<\/blockquote>\n<p>and same for \/tmp partition as well.<\/p>\n<p>Save the \/etc\/fstab file. You now need to remount the partitions for the changes to take effect. Execute the following remount commands:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>root@host [~]# mount -o remount \/tmp<\/strong><\/span>\r\n<span style=\"color: #0000ff;\"><strong>root@host [~]# mount -o remount \/dev\/shm<\/strong><\/span><\/pre>\n<\/blockquote>\n<p>You can now check the mounted partitions using the command:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>root@host [~]# mount\r\n<\/strong><\/span><\/pre>\n<\/blockquote>\n<blockquote>\n<blockquote>\n<blockquote>\n<blockquote>\n<h3><span style=\"text-decoration: underline;\"><strong>Related Links:<\/strong><\/span><\/h3>\n<\/blockquote>\n<\/blockquote>\n<\/blockquote>\n<\/blockquote>\n<blockquote>\n<blockquote>\n<blockquote>\n<pre><strong><a title=\"How to secure \/tmp on a VPS?\" href=\"https:\/\/linuxhostingsupport.net\/blog\/how-to-secure-the-tmp-partition-on-a-vps-with-noexecnosuid-option\" target=\"_blank\">How to secure \/tmp on a VPS?<\/a><\/strong><\/pre>\n<\/blockquote>\n<\/blockquote>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>How to secure \/tmp and \/dev\/shm partitions?<\/p>\n<p>It is highly recommended to mount \/tmp and \/dev\/shm partitions in noexec,nosuid mode in order to prevent files been executed under those partitions. To mount \/tmp and \/dev\/shm in noexec,nosuid more, edit the  \/etc\/fstab file and<br \/>\nsearch for the word<\/p>\n<p>&#8220;defaults&#8221; <\/p>\n<p>in front of the 2 partitions and replace them with<\/p>\n<p>rw,noexec,nosuid<\/p>\n<p>The entry should look like the following:<\/p>\n<p>tmpfs \/dev\/shm  tmpfs   rw,noexec,nosuid  0 0<\/p>\n<p>and same for \/tmp partition as well.<br \/>\nSave the \/etc\/fstab file. You now need to remount the partitions for [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[662,342,343,344,661,346,345],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/275"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=275"}],"version-history":[{"count":11,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/275\/revisions"}],"predecessor-version":[{"id":2145,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/275\/revisions\/2145"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}