Sticky bit
There may be situation where you wanted all users to store files in a certain folder but might want to restrict users from deleting other users file. For this scenario, you can set the sticky bit of the folder which will serve our purpose.
For example we have created a folder inside
/tmp directory called "user"
root@dev:/tmp# ls -l | tail -1
drwxr-xrwx 2 root root 4096 2009-07-13 11:39 user
root@dev:/tmp# cd user
Now create a file called a.txt (you are currently with root privileges)
root@dev:/tmp/user# touch a.txt
Now change to the user with normal privileges (i have created a user called 'usr100' for this purpose)
usr100@dev:/tmp/user$ su usr100
password:
usr100@dev:/tmp/user$ whoami
usr100
(more…)