LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   A question about directory permissions and rmdir GNU coreutils 8.23 (https://www.linuxquestions.org/questions/linux-software-2/a-question-about-directory-permissions-and-rmdir-gnu-coreutils-8-23-a-4175574586/)

Alpha90 03-11-2016 01:36 AM

A question about directory permissions and rmdir GNU coreutils 8.23
 
When deleting a directory with rmdir should the permission check to see if a user does have permission do delete be based on the directory in question or the parent directory of the directory to be deleted?

For example in my home directory I have 3 subdirectories, user1, user2, and a newly created and empty foo and each directory has 750 permissions while home has 755 and is owned by root:

user1 is owned by user1
user2 is owned by user2
foo is owned by root

If I were to
Code:

chown user2:user2 foo
As user1 if I were to try to
Code:

rmdir foo
I would get an error message saying I do not have permission

However if I were to move foo with root to my owned directory user1 and try:
Code:

rmdir foo
foo is removed.

I can not tell if that is an error or working as normal.

ondoho 03-11-2016 03:17 AM

it works like this on my system, too.
i find it logical.


All times are GMT -5. The time now is 02:39 PM.