4

Here's the situation:

dir1/dir2/file.txt

permissions:

drwxrwxrwx   4 me group 4.0K Jan 11 17:53 dir1
drwxr-xr-x 4 other_guy group 4.0K Jan 11 17:48 dir2
-rw-r--r-- 1 other_guy group 158 Jan 11 17:48 file.txt

Trying to remove dir2:

dir1> rm -rf dir2
rm: cannot remove 'dir2/file.txt': Permission denied

Is there any way to remove dir2 without root access?

Some context: I set up dir1 just to have a colleague share some files with me. He put dir2 and I processed everything, now I want to get rid of dir2. Is the only way to get rid of it to contact my colleague or the server admin?

  • See also unix.stackexchange.com/questions/407917/…. Note that in that question, the user does not even have read permission on the non-empty subdir, thus cannot even see what's preventing them from removing the directory. – Stefan Hamcke Jan 11 at 17:56
  • "Is there any way to remove dir2 without root access?" You can with other_guy access. – Emmanuel Jan 11 at 18:08
  • note that if this isn't done with malicious intent from other_guy, setting correct ACLs before other_guy creates a directory will grant joint inherited write access to anything created after in your directory, including subdirs. (I'd say: setfacl -m d:u:me:rwX -m d:u:other_guy:rwX dir1 ). Of course other_guy can revoke this on owned files. – A.B Jan 11 at 18:30
  • So the only ways are with other_guy and root access? If both are unavailable and dir2 takes up all of my user's allocated disk data, the machine would be unusable for me? – eimrek Jan 11 at 19:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.