Permanently change log file permissions?
I have a script that needs to read /var/log/exim_mainlog. The script does not run as root so it can't read it because exim_mainlog is -rw-r-----. I changed it to -rw-r--r--. My script works great now. But within a day or so cPanel will reset back to -rw-r----- again. How do I stop this? How to I make cPanel never reset permissions for exim_mainlog? Or get exim to log the same information to a second log file that does have 644?
-
Hey there! There isn't a good way to keep that permission from being reset. Since that file is handled by cPanel and Exim, it will reset each time there is a server or system update. It would be best to just run the script as the root user, as cPanel users should not need direct access to that log file. It's also possible that someone will comment saying you could just "chattr" the file to keep the permissions from being reset, but that will just cause other issues. 0 -
I didn't know chattr was a thing. So does anyone think I can chattr this log files to 644 without a problem? It can become immutably 644 then? 0 -
No, please don't try and chattr it. 0
Please sign in to leave a comment.
Comments
3 comments