The /tmp
directory is somewhat special as by default it allows all users to write files to it. Here is what the listing for
/tmp
looks like on my system:
drwxrwxrwt. 10 root root 4096 Mar 31 03:48 tmp
You can see this is open for everyone. The t
in the permissions indicates that the restricted deletion bit is set on the directory. So what does this actually mean? For directories, it prevents normal users from removing or renaming a file in the directory that they don’t have the proper permissions for.
As a normal user you still need to be careful when writing to /tmp
, as there are some restrictions.
Let’s try a few things to get an idea of how /tmp
works:
Run the following command:
cd /tmp
If there are any temporary
.txt
files lying around from earlier sections clean them up; anrm *.txt
file should do it.Now run the following command:
ls>root1.txt
In another session, as a guest user (I’ll use
jklewis
), run the following command:cd /tmp
Run the...