[ILUG] my /tmp is lost. Can I recover it?

Niall O Broin niall at linux.ie
Thu Oct 6 16:09:03 IST 2005


On 6 Oct 2005, at 15:47, CP Hennessy wrote:

>> So I tried to free space in /tmp and started removing files and 
>> rebooting.
>>
>> I booted properly, webserver is running, nfsd and so many services are
>> working but EVERYTHING that needs to write temp fails in /tmp is
>> failing.
>>
>> Any idea about how to fix it?
>
> Are you sure that it has the right permissions ?
> chmod 777 /tmp is your friend

chmod 777 /tmp might be YOUR friend, but it's not mine, nor is it a 
friend of any other user on the box. On a box where /tmp isn't borked, 
do this

mkdir /wrong
chmod 777 /wrong
ls -ld /tmp /wrong


and notice the difference between the permissions on /tmp and /wrong .

What is really your friend, and the friend of all users of the box, is

chmod 1777 /tmp

which allows any user to create files in /tmp, and only allows THAT 
user to erase those files.

For Andres problem, without knowing more details, he could boot in 
single user mode, and do

cd /
mv tmp bad-tmp
mkdir tmp
chmod 1777 tmp
init 2



Niall




More information about the ILUG mailing list