• LINE ID: @CARRENT
  • [email protected]
VoucherCar
  • หน้าแรก
  • สินค้า
    • แยกจังหวัดรถเช่า
    • แยกตามระดับเครื่องยนต์
    • แยกตามราคารถเช่า
    • แยกตามยี่ห้อรถเช่า

    • ตะกร้าสินค้า
    • จองด่วนน้อยกว่า 7 วัน
    • รถเช่า รายสัปดาห์
  • บทความเนื้อหา
    • คำถามพบบ่อย
    • บทความรถเช่า
    • สาขารถเช่า
    • WEBBOARD
  • วิธีการสั่งซื้อ
    • วิธีการสั่งซื้อ
    • รายละเอียดการชำระเงิน
  • จองด่วน
  • ติดต่อเรา
เข้าสู่ระบบ
รถเช่าราคาประหยัดadver
รถเช่า ประเภทต่างๆ

แยกตามจังหวัด แยกตามเครื่องยนต์ แยกตามราคา แยกตามยี่ห้อ รถเช่า รายสัปดาห์

คำถามพบบ่อยเกียวกับรถเช่า ข่าวสารบทความรถเช่า สาขาบริษัทรถเช่า เว็บบอร์ด (Webboard)

วิธีสั่งซื้อ รายละเอียดการชำระเงิน
ติดต่อเรา
รถเช่า จังหวัด

---
กลับไปหน้าเว็บบอร์ด

การทำให้ /tmp ไม่สามารถ execute ได้

ผู้ตั้งกระทู้: a
วันที่: 21/04/2009 เวลา: 09:17:31

เช็คก่อนว่ามันสามารถ execute ได้หรือไม่

vi /tmp/test.sh

Quote
#!/bin/sh
echo "Hello world"

chmod a+x test.sh
/tmp/test.sh

ถ้ารันได้ก็แสดงว่าไม่ปลอดภัย

 

code:
cd /dev

Create 100MB file for our /tmp partition. If you need more space, make count size larger.

code:
dd if=/dev/zero of=tmpMnt bs=1024 count=100000

Make an extended filesystem for our tmpMnt file

code:
/sbin/mke2fs /dev/tmpMnt

Backup your /tmp dir- I had mysql.sock file that I needed to recreate the symbolic link for. Other programs may use it to store cache files or whatever.

code:
cd /

code:
cp -R /tmp /tmp_backup

Mount the new /tmp filesystem with noexec

code:
mount -o loop,noexec,nosuid,rw /dev/tmpMnt /tmp

code:
chmod 0777 /tmp

Copy everything back to new /tmp and remove backup

code:
cp -R /tmp_backup/* /tmp/

code:
rm -rf /tmp_backup

Now we need to add this to fstab so it mounts automatically on reboots.

code:
pico -w /etc/fstab

You should see something like this:
code:
/dev/hda3               /                       ext3    defaults,usrquota        1 1
/dev/hda1               /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/shm                tmpfs   defaults        0 0
/dev/hda2               swap                    swap    defaults        0 0

At the bottom add
code:
/dev/tmpMnt             /tmp                    ext2    loop,noexec,nosuid,rw  0 0

(Each space is a tab)
Save it!
Ctrl + X and Y

Your done- /tmp is now mounted as noexec. You can sleep a little bit safer tonight. I created a hello world c++ and compiled it then moved it to /tmp. Upon trying to run it (even chmod +x'ed), it gives the following error:

code:
bash: ./a.out: Permission denied

ความคิดเห็นทั้งหมด
ยังไม่มีความคิดเห็น มาร่วมแสดงความคิดเห็นเป็นคนแรกสิ!
ร่วมแสดงความคิดเห็น

Copyright © 2026 vouchercar.com

*** ไม่อนุญาตให้ลงโฆษณาขายสินค้าใดๆ ก่อนได้รับอนุญาตจากทางเว็บนะคะ ***