Welcome Guest ( Log In | Register )




Collapse

Top Submitters

· NickTheGreek (127)
·  (127)
· www.yourforum.gr (61)
· nickpar (20)
· Big (1)

Collapse

Random Tutorials

Eset NOD32 Tutorial, Works on all versions

Tutorial name: Eset NOD32 Tutorial, Works on all versions
Submitted by: www.yourforum.gr


Collapse

Announcments


Welcome to Tutorial System!

Courtesy of www.gr8webservices.com & www.forumsandmore.com



Print this Tutorial 

How to secure /tmp

Tutorial Information
Name: How to secure /tmp
Submitter: NickTheGreek
Category: cPanel Tutorials
Submitted: 22 Sep 2012
Updated: 22 Sep 2012
Views: 211
Rating: This tutorial is unrated.
How to secure /tmp
View All Tutorials By This Member
View Discussion Topic
Description:
This will cover securing /tmp /var/tmp and /dev/shm
Tutorial Instructions
This will cover securing /tmp /var/tmp and /dev/shm Secure /tmp:

Step 1: Backup your /etc/fstab file

CODE
cp /etc/fstab /etc/fstab.bak


Step 2: Make a 3GB file for /tmp parition and an ext3 filesystem for tmp:

CODE
dd if=/dev/zero of=/var/tempFS bs=1024 count=3072000 /sbin/mkfs.ext3 /var/tempFS


*Change the count= to something higher if you need more space*

Step 3: Create a backup copy of your current /tmp drive:

CODE
cp -Rpf /tmp /tmpbackup


Step 4: Mount our new tmp parition and change permissions:

CODE
mount -o loop,noexec,nosuid,rw /var/tempFS /tmp chmod 1777 /tmp


Step 5: Copy the old data:

CODE
cp -Rpf /tmpbackup/* /tmp/


* If your /tmp was empty earlier, you might get this error : cp: cannot stat `/tmp.bak/*¢: No such file or directory

Step 6: Edit /etc/fstab and add this:

CODE
nano -w /etc/fstab


And ADD this line:

CODE
/var/tempFS /tmp ext3 loop,nosuid,noexec,rw 0 0


Step 7: Test your fstab entry:

CODE
mount -o remount /tmp


Step 8: Verify that your /tmp mount is working:

CODE
df -h


Should look something like this:

CODE
/var/tempFS 962M 18M 896M 2% /tmp



Secure /var/tmp:

Step 1: Use /tmp as /var/tmp.


CODE
mv /var/tmp /var/vartmp ln -s /tmp /var/tmp


Step 2: Copy the old data back

CODE
cp /var/vartmp/* /tmp/


* If your /var/tmp was empty earlier, you might get this error : cp: cannot stat `/var/vartmp/*¢: No such file or directory


Secure /dev/shm:

Step 1: Edit your /etc/fstab:

CODE
nano -w /etc/fstab


Locate:

CODE
none /dev/shm tmpfs defaults,rw 0 0


Change it to:

CODE
none /dev/shm tmpfs defaults,nosuid,noexec,rw 0 0


Step 2: Remount /dev/shm:

CODE
mount -o remount /dev/shm



You should restart services that uses /tmp partition
Comments
There have been no comments made as of yet. Why not be the first?



1 user(s) active
Active Users 1 guests, 0 members, 0 anonymous members
Sorted by Last Click
Quick Stats
Board Stats There have been a total of 244 tutorials in 6 categories and 0 sub-categories with 111312 views and 24 comments
The newest tutorial is How to Add “Move to” or “Copy to” to Windows 10¢s Context Menu by NickTheGreek

RSS Lo-Fi Version Time is now: 28th March 2024 - 03:53 PM
Skin and Graphics by Dan Ellis and Anubis. Hosting by Forums & More © 2005-2011.
InvisionGames - Your #1 Arcade Games Repository | AllSigs - Signatures for all | Rock Band + Guitar Hero = RockHero ! | The Remoters - Remote Assistance | FileMiners - You ask, We find