Results 1 to 2 of 2
Someone asked a question that after I looked into it didn't work as I would have guessed,so I'm here asking the question. If I create a file in mydir BUT ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-21-2006 #1
- Join Date
- Jun 2006
question about file deletion
If I create a file in mydir BUT I create it as root ,why can I delete it??
It has a root root group/owner permission so I would have thought that only root could delete it, BUT when I logon as myself I can delete it
- 12-21-2006 #2
- Join Date
- Apr 2004
What you can and can't do to a file is determined by the permissions on the file and the containing directory.
In order to delete a file you have to have write permissions for the containing directory. This does make sense because if you were to access the file after it had been deleted (say by making an extra hard link to the file) you'd see it was unchanged. What you are actually changing is the contents of the containing directory so you need write permisisons there. There is one caveat to this whereby you can set the directory permissions so others can write to the directory but only the directory owner can delete.
more information can be found here http://www.freeos.com/articles/3127/
Let us know how you get on,
Chris...To be good, you must first be bad. "Newbie" is a rank, not a slight.