1

I have a tendency to accidentally delete files I shouldn't. I'm attempting to use the restricted deletion flag to change that.

However, I am able to delete a file that does not belong to me, even when the containing folder has the restricted deletion flag set. Additionally if I try to delete using my graphical file manager, it does not even as the "are you sure" question. Any idea what I am doing wrong?

selah@selah-Precision-Tower-5810:~/sticky-test$ ll
total 12
drwxrwxr-t  3 selah selah 4096 Jul 28 11:30 ./
drwxr-xr-x 39 selah selah 4096 Jul 28 11:09 ../
drwxrwxr-x  2 selah selah 4096 Jul 28 11:16 raw-data/
-rw-rw-r--  1   999   999    0 Jul 28 11:30 something1
-rw-rw-r--  1 selah selah    0 Jul 28 11:30 something2
selah@selah-Precision-Tower-5810:~/sticky-test$ rm something1
rm: remove write-protected regular empty file 'something1'? y
selah@selah-Precision-Tower-5810:~/sticky-test$ ll
total 12
drwxrwxr-t  3 selah selah 4096 Jul 28 11:31 ./
drwxr-xr-x 39 selah selah 4096 Jul 28 11:09 ../
drwxrwxr-x  2 selah selah 4096 Jul 28 11:16 raw-data/
-rw-rw-r--  1 selah selah    0 Jul 28 11:30 something2
Selah
  • 2,905

1 Answers1

1

In this case, it is the owner of the directory, not the owner of the file, who has permission to delete the files within the directory.

So, because you are the owner of the directory, you can delete files within the directory, even if the files are owned by someone else.

There is a nice discussion here - Why use sticky bit?

The stick bit would work as you envision if the directory were owned by say root. In that event you would make the directory world rw (sudo chown root:root /home/your_user/sticky-test && sudo chmod a+rwx /home/your_user/sticky-test)

In that event you can create files but not delete files not owned by you.

Panther
  • 102,067