Hello, Alan. On Fri, Feb 13, 2015 at 08:20:13PM +0200, Alan McKinnon wrote: > On 13/02/2015 16:31, Alan Mackenzie wrote: > > Hi, Gentoo.
> > I'm clearing out dross from my home directory, as me (not as root) and > > I've just deleted this file: > > -rw-r--r-- 1 root root 0 Apr 11 2011 grep > > , simply by typing $ rm grep. I was prompted with: > > rm: remove write-protected regular empty file ■grep■? > > , to which I responded 'y'. The file is now gone. > > So, as a non root user, I've managed to delete a file belonging to root, > > to which I have no write access. This is crazy! I'm not happy about > > this. What's going on? > Nothing is going on, the system is working as designed and is doing it > correctly. It's not the permissions of a file that apply to deletion, > it's the permissions of the directory it's in. Because that's all a > delete is - remove one linee from the directory index and the file goes > away. Ah. OK. That seems fairly straighforward to grasp. > It's also the exact opposite of creating the file, how does that work? > Well you can't have write permissions yet on a file that has not been > created, the permissions must be the directory. Same with delete. > Trust me, there is no arguing with this - Unix has always worked this > way and likely always will. :-) I ask myself, how come I've got this far without learning this pretty basic fact? Thanks for the explanation. > -- > Alan McKinnon > alan.mckin...@gmail.com -- Alan Mackenzie (Nuremberg, Germany).