2

There's a really annoying situation. I own a directory but someone else created a subdirectory in it that I'd like to delete but I cannot because it's not empty. I thought, that owning the directory would give me the right to do that (I don't have root privileges). What else can I do?

$ ls -la
drwxr-xr-x   4 myself   eng         4096  Jul 21 15:17 .
drwxrwxr-t 788 root     eng         69632 Jul 20 13:20 ..
drwxrwxr-x   4 someguy  eng         8192  Jul 21 15:13 stuff
$ ls -l stuff
-rw-r-----   4 someguy  eng         8192  Jul 21 15:13 somefile
drwxr-----   4 someguy  eng         8192  Jul 21 15:13 morestuff
0

1 Answer 1

2
mv stuff ..
5
  • wont work. I got error while trying to move one directory to /tmp. I could move my own files to /tmp. Jul 22, 2009 at 7:53
  • Read man 2 rename: "EACCES Write permission is denied for the directory containing oldpath or newpath, or, search permission is denied for one of the directories in the path prefix of oldpath or newpath, or oldpath is a directory and does not allow write permission (needed to update the .. entry)." This clearly falls into the last situation.
    – ephemient
    Jul 22, 2009 at 16:41
  • Actually the OP does have write permission to oldpath (stuff), assuming he is in group eng. (I assumed that since his directory was also owned by that group, and .. is not setgid.)
    – mark4o
    Jul 22, 2009 at 17:35
  • 1
    @Saurabh The directory has to be on the same filesystem, and you need write permission to the directory you are moving, as in the question.
    – mark4o
    Jul 22, 2009 at 17:40
  • Ah, right. If you're doing a cross-filesystem mv, rename doesn't work and mv has to create new + remove old, which OP seems to lack permissions for.
    – ephemient
    Jul 22, 2009 at 17:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .