I'm writing a program, and would like it to store a log file. Problem is, the program really shouldn't be ran as root.
So if I wanted to uphold to the traditions of where files are placed, where could I keep the log file if not in /var/log that a normal user would have permissions to?
Edit: I'm using Arch linux.
Best Answer
Since the operating system you are using is missing, a more generic approach could be: Create a directory with the name of your app(say, foo) inside
/var/log
Most of all unix-like OSs will allow you to navigate through var_log folders, but not to view the logfiles contents(as expected).
Give the ownership to the user that you are using to run your program, and permission to this user(only) to see/write those logfiles
You could play with groups too, giving read access to operators for example(and of course, a different permission set of chmod, like
640
.Done. This should be generic enough to any Unix like system, and maybe, a better approach than adding a user to administrative groups.