How to stop cPanel Upgrades over-writing my custom exim.conf file

676 views Asked by At

Our exim.conf file is still getting overwritten by cpanel updates

http://serversitters.com/cpanel-overwrites-config-files.html suggests adding file to /etc/cpanelsync.exclude We tried this and it doesnt work. File is still being overwritten.

Old posts on forums.cpanel.net say you cant stop it being overwritten, but I was hoping someone else had come up with a solution.

cpanel has suggested "You should be able to use the /scripts/prebuildeximconf and /scripts/postbuildeximconf hook scripts to preserve your exim.conf modifications across updates." but we do not have these files.

What I specifically need to do is add primarydomain = "ourdomain.com" with is removed with every update. How can I get this to be added back into the file automatically after cpanel update?

3

There are 3 answers

0
Jason Pascoe On BEST ANSWER

According to CPanel, you can't stop it being updated.

1
24x7servermanagement On

I will suggest you please give a try with file attributes options. Setup the attributes to your exim configuration file so that it will not update in upcp process.

0
imvikasmunjal On

You can add attributes to file.

Use the below command to change the attributes of file /etc/exim.conf

Step 1 Check the current permissions

root@server2 [~]# ls -lh /etc/exim.conf

-rw-r--r-- 1 root root 67K Jan 19 12:28 /etc//exim.conf

Step 2 modify permissions to read only for root also by using chmod command

root@server2 [/etc]# chmod 444 exim.conf

Step 3 Check the modifications

root@server2 [/etc]# ls -l exim.conf

-r--r--r-- 1 root root 68318 Jan 19 12:28 exim.conf

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Now use the attributes so that c-panel updates can not put any affect to exim.conf

Step 4 root@server2 [/etc]# chattr +ia exim.conf

++++++++++++++++++++++++++++++++++++++++++++++

chattr +i : A file is set with ā€˜iā€˜ attribute, cannot be modified (immutable). Means no renaming, no symbolic link creation, no execution, no writable, only superuser can unset the attribute.

chattr +a : A file is set with ā€˜iā€˜ attribute, cannot be modified (immutable). Means no renaming, no symbolic link creation, no execution, no writable, only superuser can unset the attribute.

++++++++++++++++++++++++++++++++++++++++++++++

Step 5 Check the attributes

root@server2 [/etc]# lsattr exim.conf

----ia-A-----e- exim.conf

Step 6

When you want to modify the file again change attributes of file.

root@server2 [/etc]# chattr -ia exim.conf and change permissions back to 644. ++++++++++++++++++++++++++++++++++++++++++

This will sort out the C-Panel automatic update problem.