How to delete that directory

directorypermissionsrm

I have a directory, that I cannot delete with rmdir. I get always a permission denied error. But when list the directory (with ls -l) I get this:

drwxrwxrwx  2 user user 4096 Aug 28 09:34 directory

stat gives me that:

  File: `directory/'
  Size: 4096            Blocks: 16         IO Block: 32768  directory
Device: 12h/18d Inode: 102368771   Links: 2
Access: (0777/drwxrwxrwx)  Uid: ( 1000/  user)   Gid: ( 1000/  user)
Access: 2015-08-31 03:00:20.630000002 +0200
Modify: 2015-08-28 09:34:16.772930001 +0200
Change: 2015-08-31 12:25:04.920000000 +0200

So how delete that directory.

Best Answer

If you are trying to delete a directory foo/bar/, the permissions of bar isn't the relevant factor. Removing the name bar from directory foo is a modification of foo. So you need write permissions on foo.

In your case, check the current directory's permissions with ls -ld .

You might find this answer to "why is rm allowed to delete a file under ownership of a different user?" enlightening.

Related Question