SOLVED secure /tmp directory

jimlongo

Well-Known Member
Mar 20, 2008
242
20
68
Tried to run the following script on a CentOS VPS
Code:
# /scripts/securetmp 
*** Notice *** No loop module detected
If the loopback block device is built as a module, try running `modprobe loop` as root via ssh and running this script again.
If the loopback block device is built into the kernel itself, you can ignore this message.
*** Notice *** No working loopback device files found. Try running `modprobe loop` as root via ssh and running this script again.
Then following that instruction
Code:
# modprobe loop
FATAL: Could not load /lib/modules/2.6.18-028stab099.3/modules.dep: No such file or directory
Thanks for any help you can offer.
 

Spetsnaz

Well-Known Member
Jun 25, 2011
78
0
56
cPanel Access Level
Website Owner
I am currently having the same issue

[email protected] [~]# /scripts/securetmp
*** Notice *** No loop module detected
If the loopback block device is built as a module, try running `modprobe loop` as root via ssh and running this script again.
If the loopback block device is built into the kernel itself, you can ignore this message.
*** Notice *** No working loopback device files found. Try running `modprobe loop` as root via ssh and running this script again.
[email protected] [~]#
 

ItsMattSon

Well-Known Member
Sep 5, 2016
182
38
103
Perth
cPanel Access Level
Root Administrator
BUMP

I'm experiencing this same issue because I'm on an OpenVZ VPS and can't run /scripts/securetmp without hitting this response either.

Is there a way to secure tmp on OpenVZ VPS or is there no solution for us?

EDIT: Apologies, found this online which I believe answered my question. Where it says to remount though, /tmp was never mounted so i used "mount /tmp".

"On an OpenVZ VPS you will need to do the following to secure /tmp and /var/tmp.

Secure /tmp

  1. Edit /etc/fstab by typing the command nano -w /etc/fstab
  2. Paste the following at the bottom of /etc/stab that you just opened: none /tmp tmpfs nodev,nosuid,noexec 0 0
  3. Press ctrl + x to close the file, press y to save it.
  4. Remount /tmp by typing the following then press enter: mount -o remount /tmp
  5. 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.
Secure /var/tmp

  1. Backup /var/tmp by typing the following: mv /var/tmp /var/tmpbackup
  2. Make a symbolic link that makes /var/tmp point to /tmp by typing the following: ln -s /tmp /var/tmp
  3. Copy back the old data using the command: cp /var/tmpbackup/* /tmp/
  4. 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."
 
Last edited:
  • Like
Reactions: cPanelMichael

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
EDIT: Apologies, found this online which I believe answered my question. Where it says to remount though, /tmp was never mounted so i used "mount /tmp".
Hello,

I'm happy to see you were able to address the issue. Thank you for updating us with the outcome.