linux how to create read-only /tmp partation August 11, 2011 at 4:44 pm
# 100MB file for /tmp
dd if=/dev/zero of=/dev/tmpMnt bs=1024 count=100000
# extended filesystem
mke2fs /dev/tmpMnt
# backup cp -p -r /tmp /home/backup/tmp
# mount with noexec
mount -o loop,noexec,nosuid,rw /dev/tmpMnt /tmp
chmod 0777 /tmp
# add to fstab so it can reboot
vi /etc/fstab
/dev/tmpMnt /tmp ext2 loop,noexec,nosuid,rw 0 0
# now nothing should run # bash: ./binary-program: Permission denied

Leave a Reply
You must be logged in to post a comment.