Permanently change log file permissions?

Scott Galambos

Well-Known Member
Jul 13, 2016
102
4
68
Canada
cPanel Access Level
Root Administrator
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?
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,442
1,004
313
cPanel Access Level
Root Administrator
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.