Securing /tmp is an important part in linux system. I am quoting the general way to secure /tmp in case it is not mounted as a separate partition:
1. Create a file inside /dev with the required size using dd command. Here I am using 500MB.
cd /dev
dd if=/dev/zero of=tmpDSK bs=1024 count=500000
2. Format it with the required filesystem.
mkfs.ext3 /dev/tmpDSK
3. If you need to backup current /tmp dir, do it using cp -rp command. After that mount the newly created file /dev/tmpDSK on /tmp.
mount -o loop,noexec,nosuid,rw /dev/tmpDSK /tmp
4. Give sticky bit and full permission to /tmp.
chmod 1777 /tmp
5. Create entries in /etc/fstab for mounting /tmp during boot process.
vim /etc/fstab
/dev/tmpDSK /tmp ext3 loop,noexec,nosuid,rw 0 0
Save the file.
That is it. You have now got a secured /tmp directory!
Tuesday, April 26, 2011
Securing /tmp in linux
Subscribe to:
Post Comments (Atom)






0 comments:
Post a Comment