Why can't I delete a file where I have group write permissions on?

Solution 1:

Because by deleting a file, you are not just modifying the file but also modifying its directory.

So if your file is:

rwxrwxr-x

You would be able to do:

cp /dev/null <filename>

But if your directory permissions are:

rwxr-xr-x  root  data  <directory name>

Then system will prevent you removing the file.

Solution 2:

File deletion is based on directory perms, not file perms (*).

Do you have write permissions on the directory that contains the file?

(*) Caveat, you can have a directory where you enforce that only the owner of the file can delete it. This is useful for temp dirs.

Solution 3:

If the containing directory does not permit the user boby or the data group to write to it, then that would explain this behavior.

Solution 4:

I tried the same thing, and ran into the same problem.

Starting a new terminal session the problem. This can be achieved by:

  1. Logging out and logging back in
  2. Going to one of the 6 ttys (Ctrl+Alt+F1-6) (Note: Ctrl+Alt+F7 is your GUI session)
  3. using su boby to start a new session for user boby.

Cheers!

Solution 5:

I bet the file you're trying to delete is in /tmp.

See Linux - group member cannot delete file with rw permission

/tmp usually has the "sticky" aka "restricted deletion" mode set (o+t). With this mode set, only the file's owner can move or delete files in that directory regardless of any permissions.