0

I've noticed that some graphical file manages such as Thunar allow you to remove any directory as long as you are the owner of this directory -- even if this directory contains a sub directory which you do not have write access to. On the other hand, rm -rf won't allow you to delete such a directory (Permission denied).

Example:

dirOwnedByUser
└──dirOwnedByRoot

$ rm -rf dirOwnedByUser 
rm: cannot remove 'dirOwnedByUser/dirOwnedByRoot: Permission denied
  1. Could some explain this to me?
  2. Is there a way to delete such a directory in Shell?
  • 1
    have a look at catchlinux.com/permissions-primer one way to delete will be as root user.. try sudo rm -rf dirOwnedByUser and give root password when prompted – Sundeep Jul 13 '16 at 10:59
  • If rm can't do it, Thunar can't do it either. (Unless you give Thunar root privileges of course.) Are you sure you attempted to remove the same directory? Are you sure you removed the directory, rather than moving it to the trash (which doesn't touch the subdirectories at all and therefore isn't affected by their permissions)? – Gilles Jul 13 '16 at 22:42
  • This is what I do: I create a user directory data. Then I run a Docker container which creates a volume share in data. share is owned by root and therefore can't be directly deleted by the user (neither using Thunar nor using rm). But the user can delete data using Thunar. Following this "workaround", the user can indirectly remove data/share. – Lugaxx Jul 14 '16 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.