Why I am being able to delete a root ownedfile?
Ok, there is this file "a" that has rwx permissions for everyone, so anyone can erase it.
I use cp to create "a2". a2 is created with has similar permissions, excepted that, for some reason, it does not allow members of other groups to write it. Then I use chown to make it to belong to root. Yet, when I return to my normal user, I can erase it. How is that possible? And how I can avoid it? Thanks for the help. |
How did you use cp? As root?
What are the permies of the containing directory? |
The copy of a file doesn't have to have the same permissions as the original file.
As scasey alludes, to delete a file, you need write permission in the directory that contains the file. To prevent a normal user from deleting the file, remove directory write permissions. Rather than describing your actions, it would be better to list the commands you enter and show the details of the files you create. |
Hi,
It is not clear what you mean by "erase" the file, and how it can be different to "delete" the file. If "erase" the file is emptying its content, then you need write permission to the file. Remark that the file will still exist after being "erased", but with an empty content. But differently, you need write permission to the containing folder to be able to "delete" the file. That had been hinted by scasey in post #2. |
Quote:
Use --verbose switches where possible, and output of 'ls -al'. |
All times are GMT -5. The time now is 02:00 PM. |