How to secure /tmp and /var/tmp
- Edit /etc/fstab by typing the command nano -w /etc/fstab
- Paste the following at the bottom of /etc/stab that you just opened: none /tmp tmpfs nodev,nosuid,noexec 0 0
- Press ctrl + x to close the file, press y to save it.
- Remount /tmp by typing the following then press enter: mount -o remount /tmp
- You can verify that /tmp is correctly mounted by typing df -h and you should see something similar to the following: none 3.9G 0 3.9MG 0% /tmp.
- Backup /var/tmp by typing the following: mv /var/tmp /var/tmpbackup
- Make a symbolic link that makes /var/tmp point to /tmp by typing the following: ln -s /tmp /var/tmp
- Copy back the old data using the command: cp /var/tmpbackup/* /tmp/
- Remove the un-needed backup you created: rm -rf /var/tmpbackup
You should now reboot your VPS. This means /tmp and /var/tmp are now secured.
Was this answer helpful?
Hotlink Protection prevents other web sites from directly linking to certain files (typically...
Everyone knows 22 is the default SSH port. So it’s always good to change this default port...
In the below examples we are using ETH0 as network interface, however if you are using our...
PHP's default configuration file, php.ini (usually found in /etc/php.ini on most Linux systems)...
Follow the below steps to install “mod_security”. ModSecurity supplies an array of...