[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to run automatically a script as soon root login



Le 13/05/2024 à 15:03, Richmond a écrit :
Erwan David <erwan@rail.eu.org> writes:

Le 13/05/2024 à 14:36, Richmond a écrit :
I was experimenting, and found this works:

sudo xterm -e "echo 1 > hello"

It created a file owned by root. But I found I was able to remove it
without being root even though group and world permissions were read
only.


thats because sudo exceutes a xterm as root

then this xterm executes a shell (as root) and this root shell does
the redirection.
Yes, but why did it allow me to delete the file? I was not root
then. Try it.


as said Dan Ritter : the owner of the directory can delete any file inside the directory.

(see a directory as a special file containing pairs (name,file place on the disk). Deleting a file is just removing the pair from the directory, thus it is editing the directory, not the file.

--
Erwan David


Reply to: