{"id":1128,"date":"2010-10-27T10:05:41","date_gmt":"2010-10-27T14:05:41","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=1128"},"modified":"2013-03-20T08:43:57","modified_gmt":"2013-03-20T12:43:57","slug":"how-to-secure-the-tmp-partition-on-a-vps-with-noexecnosuid-option","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/how-to-secure-the-tmp-partition-on-a-vps-with-noexecnosuid-option","title":{"rendered":"How to secure the \/tmp partition on a VPS with noexec,nosuid option?"},"content":{"rendered":"<p>On a VPS, there are 2 ways to mount OR secure \/tmp and \/var\/tmp partitions with the noexec,nosuid option. One way is to mount these partitions from the Host Node (hosting provider can do this) and the other way is to mount them from within the VPS.<\/p>\n<p><strong>1)<\/strong> Login to the Node server and execute the following command:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># vzctl set VEID --bindmount_add \/tmp,noexec,nosuid,nodev --save <\/span>\r\n<span style=\"color: #0000ff;\"># vzctl set VEID --bindmount_add \/var\/tmp,noexec,nosuid,nodev --save<\/span><\/pre>\n<\/blockquote>\n<p>The &#8220;bindmount_add&#8221; option is use to mount the partition inside the VPS. The &#8216;VEID&#8217; is the VPS ID you are working on.<\/p>\n<p><strong>2)<\/strong> The second option is to mount these partition from within the VPS itself. It is useful incase you don&#8217;t have access to the Node server. To mount \/tmp and \/var\/tmp from within the VPS, execute:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># mount -t tmpfs -o noexec,nosuid,nodev tmpfs \/tmp <\/span>\r\n<span style=\"color: #0000ff;\"># mount -t tmpfs -o noexec,nosuid,nodev tmpfs \/var\/tmp<\/span><\/pre>\n<\/blockquote>\n<p>To check the mounted &#8216;tmp&#8217; partitions, execute<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># mount | grep tmp <\/span>\r\n <span style=\"color: #0000ff;\">tmpfs on \/tmp type tmpfs (rw,noexec,nosuid) <\/span>\r\n <span style=\"color: #0000ff;\">tmpfs on \/var\/tmp type tmpfs (rw,noexec,nosuid,nodev)<strong> <\/strong><\/span><\/pre>\n<\/blockquote>\n<h3><span style=\"text-decoration: underline;\">Related Links:<\/span><\/h3>\n<pre> <strong><a title=\"How to Secure \/tmp on a Dedicated Server?\" href=\"https:\/\/linuxhostingsupport.net\/blog\/howto-secure-tmp-and-devshm\" target=\"_blank\">How to Secure \/tmp on Dedicated server?<\/a><\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>On a VPS, there are 2 ways to mount OR secure \/tmp and \/var\/tmp partitions with the noexec,nosuid option. One way is to mount these partitions from the Host Node (hosting provider can do this) and the other way is to mount them from within the VPS.<br \/>\n1) Login to the Node server and execute the following command:<\/p>\n<p># vzctl set VEID &#8211;bindmount_add \/tmp,noexec,nosuid,nodev &#8211;save<br \/>\n# vzctl set VEID &#8211;bindmount_add \/var\/tmp,noexec,nosuid,nodev &#8211;save<\/p>\n<p>The &#8220;bindmount_add&#8221; option is use to mount the partition inside the VPS. The &#8216;VEID&#8217; is the VPS ID you [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1110,1111,1108,1106,1107,1109],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1128"}],"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=1128"}],"version-history":[{"count":19,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1128\/revisions"}],"predecessor-version":[{"id":2275,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1128\/revisions\/2275"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=1128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=1128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=1128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}