Haven't been here much. Mostly Stackoverflow. Anyway, I have a file that I can't remove.
I tried sudo rm files.db
and got
Operation not permitted
Did sudo chown me: files.db
Then sudo chmod 777 files.db
Tried sudo rm files.db
again and got same result.
ls -l
produces:
-rwx------ 1 me staff 34177024 Jun 6 23:58 files.db
I had hoped to see:
-rwxrwxrwx 1 me staff 34177024 Jun 6 23:58 files.db
Tried sudo chflags noschg files.db
Then sudo chmod 777 files.db
and then still got:
-rwx------ 1 me staff 34177024 Jun 6 23:58 files.db
What am I missing?
UPDATE:
Tried su user rm -rf files.db
put in my password and got:
su: Sorry
I used this drive for Time Machine backups.
Isn't there some way to force a removal?
ANOTHER UPDATE:
Not sure how this works but tried ls -i
and got:
5482053549 files.db
Then find . -inum 5482053549 -delete
and got:
find: -delete: unlink(./files.db): Operation not permitted
Also tried find . -inum 5482053549 -exec rm {} \;
and got:
rm: ./files.db: Operation not permitted
Ugh.
LAST UPDATE:
This morning I did the following: chown me folder
and then chmod 777 folder
. I was then was able to delete the file.
su
requires the root password, not your own password. – tripleee Jun 07 '13 at 07:23lsattr
on the file is the immutable attribute set on the file? The tip-off for me was the fact that you're sudo'ing to root and it's still denying you. root has CAP_DAC_OVERRIDE (or whatever the equivalent on OS X is) so I don't think it's a permissions issue. On Linux immutable is handled by a separate CAP_LINUX_IMMUTABLE capability which only affectschattr
invocations. There's probably a similar idea in the BSD/OS X world. – Bratchley Jun 07 '13 at 12:46