Securing /tmp

i would love to pay for help, if i could afford. unfortunately in this momemnt i am broke and jobless. thanks for your quick response.

this is what i am getting

MySQL is running but PID file could not be found [FAILED]
 
after googling for couple of hours , i was able to restart mysql, however still i wanna undo /tmp folder secure thingy, in order to avoid this sort of error in the future .
 
Hi,
My intention is to protect / tmp so that it can not run anything there


I tried the following:

Code:
cd /dev
dd if=/dev/zero of=Tmp bs=1024 count=512000
dd if=/dev/zero of=varTmp bs=1024 count=102400

mkfs -t ext3 /dev/Tmp
mkfs -t ext3 /dev/varTmp

cd /
cp -aR /tmp /tmp_backup
mount -o loop,noexec,nosuid,rw /dev/Tmp /tmp
cp -aR /tmp_backup/* /tmp/
chmod 0777 /tmp
chmod +t /tmp

cd /var/
cp -aR /var/tmp /var/tmp_backup
mount -o loop,noexec,nosuid,rw /dev/varTmp /var/tmp
cp -aR /var/tmp_backup/* /var/tmp/
chmod 0777 /var/tmp
chmod +t /var/tmp

df -h (Confirm everything is working)

Add the mount to your /etc/fstab
/dev/Tmp        /tmp            ext3    loop,noexec,nosuid,rw   0       0
/dev/varTmp     /var/tmp        ext3    loop,noexec,nosuid,rw   0       0


So far so good ... I think a script in / tmp ... try to run and gives me access denied ...

Run df -h and the result is the following:

Code:
/dev/sda1 5.0G 1.3G 3.4G 28% /
/dev/sda2 224G 33M 213G 1% /home
/dev/shm 1005M 0 1005M 0% /dev/shm
/dev/Tmp 485M 16M 444M 4% /tmp
/dev/varTmp 97M 5.6M 87M 7% /var/tmp

The problem is when you reboot, I have the same as at the beginning ...

df -h and I get the following:

Code:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 5.0G 1.3G 3.4G 28% /
/dev/sda2 224G 33M 213G 1% /home
/dev/shm 1005M 0 1005M 0% /dev/shm

Helpme please,
Thank's.
 
Hi,

I don't know, if it's a good idea to post here.

My /tmpMnt file is corrupted. I have some file in it, that are impossible to delete, and a lot of errors in /var/log/message (probably cause by this problem).

Is it possible to destroy this file ? and do it again ?
What is the best solution for that ?
 
Hi,

I don't know, if it's a good idea to post here.

My /tmpMnt file is corrupted. I have some file in it, that are impossible to delete, and a lot of errors in /var/log/message (probably cause by this problem).

Is it possible to destroy this file ? and do it again ?
What is the best solution for that ?

What makes these files impossible to delete? If it is because of their name (i.e. "-ltr") then I have always been able to delete this files by using a perl command to unlink the file.

#!/usr/bin/perl
unlink("-ltr");

That way the shell won't assume the - was an optional parameter.

If that is not the case, then you can always just recreate your /tmpMnt from scratch.
 
Back
Top