can't delete a file although permissions seem correct

Paul Howarth paul at city-fan.org
Wed Dec 8 13:06:23 UTC 2004


Marius Andreiana wrote:
> Hi
> 
> I've encountered a weird situation where I can't delete a file:
> (reproductile on rh9 and fc3, no selinux)
> 
> $ id
> uid=500(marius) gid=500(marius) groups=500(marius)
> 
> mkdir d1
> 
>>d1/a.txt
> 
> chmod 571 d1
> chmod 460 d1/*
> ls -al d1/
> total 12
> dr-xrwx--x   2 marius marius 4096 Dec  8 15:01 .
> drwxrwxrwt  17 root   root   4096 Dec  8 15:01 ..
> -r--rw----   1 marius marius    0 Dec  8 15:01 a.txt
> 
> rm d1/a.txt
> rm: remove write-protected regular empty file `d1/a.txt'? y
> rm: cannot remove `d1/a.txt': Permission denied
> 
> The directory d2 has write permissions for my group, and file it's
> writable by group. I belong to that group, why can't the file be
> removed?

The directory d2 also has permissions that say that user "marius" does not 
have write permission. Generally, user permissions overrule group permissions, 
which overrule other permissions. Try setting the permissions of d2 to 771 
instead of 571. You should then be able to remove a.txt even if it is 
permission 440 rather than 460.

Paul.




More information about the fedora-list mailing list