12
[db2inst1][testing ~/sqllib/db2dump] rm db2diag.log 
rm: cannot remove `db2diag.log': Permission denied
[db2inst1][testing ~/sqllib/db2dump] id
uid=1002(db2inst1) gid=107(db2iadm1) groups=16(dialout),33(video),107(db2iadm1),108(db2fadm1),1001(eduserver)
[db2inst1][testing ~/sqllib/db2dump] ll
total 1381172
-rw-rw-rw- 1 root db2iadm1 1412931954 Oct  2 10:24 db2diag.log

Currently logged user (db2inst1) is part of db2iadm1 group that has w permission to the file I want to delete. But I am not able. Any idea why?

update - permission for parent directory

drwxr-sr-x 2 root db2iadm1 4096 Aug 22 14:39 db2dump

11

In order to delete a file, you must have write permissions on the directory that the file resides in. When you rm a file it makes the unlink system call which removes the name from the directory. This only deletes the file if it is the last remaining link to the inode.

You can find more information in unlink(2).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.