How to secure /tmp partition on openVZ

You should always secure your /tmp partition, but due to the way a vps is setup, you cannot mount due to loop back issues, follow the tutorial below, and you can secure it with 7 simple commands!

Ensure you first have made the partition the size you wish!

Step one: rm -rf /tmp (Get rid of the old)

Step two: mkdir /tmp (In with the new)

Step three: mount -t tmpfs -o rw,noexec,nosuid tmpfs /tmp (mount it)

Step four: chmod 1777 /tmp (Set the correct permissions)

Step five: echo "tmpfs   /tmp    tmpfs   rw,noexec,nosuid        0       0" >> /etc/fstab (disable it from running scripts in fstab)

Step six: rm -rf /var/tmp

Step seven: ln -s /tmp /var/tmp

You may also add an extra line to fstab (vi /etc/fstab) and add the line: none /tmp tmpfs nodev,nosuid,noexec 0 0

You can now be at ease knowing your /tmp partition is secure, and exploits cannot run in the partition!

  • 24 Users Found This Useful
Was this answer helpful?

Related Articles

Set up time.

Ever wanted to know how long it takes for your account to be set up? Well we have the answer,...

Payment methods

What payment methods we offer are, PayPal, 2checkout.com  and moneybookers.

TunTap module not working

Usually the TunTap module can have either permission errors or it is basically not enabled for...

What control panel do you use?

Since hyperVM had stopped being developed and became a large security issue, we have started to...

Semi-Managed

You might think or wounder what do i get with semi-managed services? Basically you get reboot...

Powered by WHMCompleteSolution