3

This is my setup

[root@ ~]# mkdir /sticky01
[root@ ~]# chown user01:user01 /sticky01
[root@ ~]# chmod a+rwx /sticky01
[root@ ~]# chmod +t /sticky01
[root@ ~]# ls -ld /sticky01
drwxrwxrwt. 3 user01 user01 22 Apr  8 06:10 /sticky01

I have a directory with sticky bit and it is world readable, world writable.

user02 writes to the directory:

[user02@ sticky01]$ ls
[user02@ sticky01]$ mkdir no-sub
[user02@ sticky01]$ mkdir with-sub
[user02@ sticky01]$ mkdir with-sub/sub-01
[user02@ sticky01]$ date > content.txt
[user02@ sticky01]$ ls -l
total 4
-rw-rw-r--. 1 user02 user02 30 Apr  8 06:09 content.txt
drwxrwxr-x. 2 user02 user02  6 Apr  8 06:09 no-sub
drwxrwxr-x. 3 user02 user02 20 Apr  8 06:09 with-sub

One file One directory with no content One directory with a sub-directory

Now here is the problem:

[user01@ sticky01]$ rm content.txt 
rm: remove write-protected regular file ‘content.txt’? y
[user01@ sticky01]$ ls -l
total 0
drwxrwxr-x. 2 user02 user02  6 Apr  8 06:09 no-sub
drwxrwxr-x. 3 user02 user02 20 Apr  8 06:09 with-sub
[user01@ sticky01]$ rm -rf no-sub/
[user01@ sticky01]$ ls -l
total 0
drwxrwxr-x. 3 user02 user02 20 Apr  8 06:09 with-sub
[user01@ sticky01]$ rm -rf with-sub/
rm: cannot remove ‘with-sub/sub-01’: Permission denied
[user01@ sticky01]$ ls -l
total 0
drwxrwxr-x. 3 user02 user02 20 Apr  8 06:09 with-sub

How can user01 delete the directory?

A sticky bit on a directory allows the owner of the directory to delete the files in the directory. However if the other user creates a subdirectory, then this permission seems to be lost. Is not not open to abuse for anybody just to create a subdirectory and put files in that subdirectory so that the owner of the sticky bit can't delete it?

0

0

Browse other questions tagged .