On Mon, May 13, 2024 at 09:17:31AM -0400, Greg Wooledge wrote:
> On Mon, May 13, 2024 at 02:03:59PM +0100, Richmond wrote:
> > >> sudo xterm -e "echo 1 > hello"
>
> > Yes, but why did it allow me to delete the file? I was not root
> > then. Try it.
>
> Because you have write permission on the *directory* that the file is in.
>
> Removing (unlinking) a file is an operation that modifies a directory,
> not the file itself. You don't need write permission on the file. Just
> the directory.
Unless the directory has the sticky bit set (e.g. /tmp).
(For completeness: I know you know that).
Cheers
--
t