ก๊วนซอฟท์แวร์ </softganz> SoftGang (Gang Software)

Web &amp; Software Developer Gang.

ขั้นตอนทำ /tmp ให้ Security (How-to from www.directadmin)

by Little Bear @3 ส.ค. 52 18:32 ( IP : 61...107 ) | Tags : Server , Security , DirectAdmin

Step 1: Securing /tmp

Step 1.1: Backup your fstab file

cp /etc/fstab /etc/fstab.bak

Step 1.2: Creating tmpmnt partition file (Around 1Gb in size)

cd /var
dd if=/dev/zero of=tmpMnt bs=1024 count=1048576

Step 1.3: Format the new partition

mkfs.ext3 -j /var/tmpMnt

Press Y when asked

Step 1.4: Making backup of old /tmp

cp -Rp /tmp /tmp_backup

Step 1.5: Mount the tmp filesystem

mount -o loop,noexec,nosuid,rw /var/tmpMnt /tmp

Step 1.6: Set the right permissions

chmod 0777 /tmp

Step 1.7: Copy the files back to new tmp folder

cp -Rp /tmp_backup/* /tmp/

Step 1.8: Adding new /tmp filesystem to fstab

echo "/var/tmpMnt /tmp ext3 loop,rw,noexec,nosuid,nodev 0 0" >> /etc/fstab

Step 2: No need for 2 tmp filesystems, so we symlink /var/tmp to /tmp

rm -rf /var/tmp/
ln -s /tmp/ /var/tmp

ปล.ลองทำแล้ว แต่ติดอยู่ที่ step 1.5 มีแจ้งว่า "mount: no permission to look at /dev/loop#" พอทำต่อ เหมือนกับไม่สำเร็จ

Relate topics