On Sat November 4 2006 10:41 pm, Randall R Schulz wrote:
Richard,
On Saturday 04 November 2006 21:34, Richard wrote:
I ready for the big head slap with a following, "well, duh..." I am trying to remove files, .rpm files as it happens from a drive. Even as root, it is refused, "Operation not permitted". I even looked up and tried shred, which also gives an error message. Chmod will not allow changing any file permissions or ownership...I only thought if I could change one of those that might make it more amenable to deletion. Is there maybe something about the drive itself that might be making it un-writable/deletable. I would certainly consider writing a new file system to the drive as I want nothing on it. I took a short look at hdparm and elected to ask here before doing anything I might later regret...and then come back here to try to fix.
One of the perpetually confusing things about the Unix file system and its permissions scheme is that the ability to delete a file has nothing to do with the file's permissions, at least not as far as the kernel is concerned (more later on the weasel-words and an actual exception).
The ability to create a file or delete a file is governed by the directory in which the file exists or is to be created. The required permissions include both execute and write. The seeming exception is that the "rm" will ask you if you want to delete a file for which you do not have write permissions. But the actual ability to delete a file, (once you say "yes" to the "rm: remove write-protected regular file `fileName'?" confirmation question) still comes down to you having write and execute permission on the directory in which the file resides.
Nor does it matter who owns the file, but there's an exception to that, too. Look at the modes on /tmp (assuming a conventional setup):
% ll -d /tmp drwxrwxrwt 64 root root 32768 2006-11-04 22:33 /tmp/
Note the 't' bit. This stands for "sticky" (and in its original meaning had nothing to do with directories, but that's irrelevant here). When a directory has its sticky bit set, only the owner of a file may remove it, still subject to the other permissions check on the directory itself. This feature is used by directories such as /tmp or "drop folders" where it's desired that anyone be able to create files but not interfere with each other's use of such a shared diretory.
Note, too, that only the owner of a file (and root) may change a file's (or directory's) mode. And only root may change a file's or directory's owner. Non-root users may neither take ownership of files they don't own nor give away files they do own.
Thanks for any suggestions.
Take that information and verify that the existing permission allow you to remove the files in question.
Richard
Randall Schulz
Randall: this is clearly one of the best and most direct explanations of linux permissions I have seen. Thank you. This will go in Linuxinfo save box, where I keep stuff from this list for future reference. I was aware that I could probably not get away with changing any of those features, but tried to I guess just to see if I could do something/anything to the files. Nada. I suppose what I found was that I could not access them at all, and could not even add files or directories. What with M Harris, Basil, and John have suggested, I think it is clear the fs is corrupted, and with not being able to fix with reiser tools, I suspect hopelessly so. As I suggested before, saving the data is not an interest for me. .rpm files there were a download for use with an installation of SuSE 9.3, or maybe earlier, so not of current interest or use to me. At this point, I think the best course is to "re-format" the drive. I suppose I could use the partitioning tools that came with the drive, then re-install a linux fs. I suspect there may be a more direct way also. Somehow, as I follow threads on this list in the past there often crop up some esoteric command, simple, direct, easy, just un-common enough not to be immediately at fingertip. Thanks for your concise permissions description. I may even "memorize" it for new potential users I talk to to explain it all to them. Richard