PDA

View Full Version : SecureTmp cPanel script - enable, disable



Fli
10-04-2015, 01:34 PM
How to use cPanels /scripts/securetmp (https://documentation.cpanel.net/display/ALD/The+Securetmp+Script) ?

Enable securetmp (http://documentation.cpanel.net/display/ALD/The+Securetmp+Script):

# /scripts/securetmp

If received an error "mount: Could not find any loop device. Maybe this kernel does not know about the loop device? (If so, recompile or `modprobe loop'.)"

if "modprobe loop" on host node fails with "FATAL: Module loop not found." error, note that on OpenVZ loop devices are not supported.

Disable securetmp (http://documentation.cpanel.net/display/ALD/The+Securetmp+Script):

cat /etc/rc.d/rc.local | grep sec;touch /var/cpanel/version/securetmp_disabled;cat /etc/rc.d/rc.local | grep sec

check /tmp dir:
# ls -lh /tmp | grep -v sess

drwxrwxrwt 3 root root 4.1M Oct 4 13:38 ./
drwxr-xr-x 27 root root 4.0K Sep 28 14:14 ../
-rw------- 1 cpanel cpanel 0 Oct 3 20:00 .ftpquota
-rw-r--r-- 1 root root 2.3K Oct 4 06:35 lastcpanels
lrwxrwxrwx 1 root root 27 Oct 3 20:00 mysql.sock -> ../var/lib/mysql/mysql.sock=
drwx------ 2 mysql mysql 40 Oct 4 13:38 mysqltmp/

Im using custom directory/mounted filesystem: "/tmp/mysqltmp"
and mysql.sock is also there. So i will want to first stop mysql before doing anything with files.


/etc/init.d/chkservd stop # stop service that monitoring services running
/etc/init.d/mysql stop # stop mysql service

Unmount filesystems:

umount /tmp
umount /var/tmp
umount /tmp/mysqltmp # im using this custom mysql tmpdir filesystem (http://internetlifeforum.com/mysql-apache-php/3997-increase-mysql-performance-reduce-hdd-i-o-load-using-ram-tmp_tables/), you may not

/tmp is created and has proper permissions:

mkdir /tmp;chmod 1777 /tmp;chown root:root /tmp;ls -lh /tmp | grep -v sess

mysql.sock symlink is not there? then create it:


cd /tmp
ln -s /var/lib/mysql/mysql.sock


mount /tmp/mysqltmp # im using this custom mysql tmpdir filesystem (http://internetlifeforum.com/mysql-apache-php/3997-increase-mysql-performance-reduce-hdd-i-o-load-using-ram-tmp_tables/), you may not

Start services again:


/etc/init.d/mysql start
/etc/init.d/chkservd start