Tutorial :Creating Read-only logs with python


I am writing a python script that needs to make a log entry whenever it's invoked. The log created by the script must not be changeable by the user (except root) who invoked the script. I tried the syslog module and while this does exactly what I want in terms of file permissions, I need to be able to put the resulting log file in an arbitrary location. How would I go about doing this?


I see you are on linux,

Depending on which filesystem you are using, you may be able to use the chattr command. You can make files that are append only by setting the a attribute


Run your script with setuid root.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »