diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 4db0da1ecfd5a44ad177c9daacdb65e379f7f55a..6fd8024e869b4766d13de0d3ddd61a33cf82ffdf 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -1578,13 +1578,13 @@ class installer_base {
 			exec('cp tpl/rspamd_neural_group.conf.master /etc/rspamd/local.d/neural_group.conf');
 		}
 
-		exec('chmod a+r /etc/rspamd/local.d/* /etc/rspamd/override.d/*');
-
 		$tpl = new tpl();
 		$tpl->newTemplate('rspamd_dkim_signing.conf.master');
 		$tpl->setVar('dkim_path', $mail_config['dkim_path']);
 		wf('/etc/rspamd/local.d/dkim_signing.conf', $tpl->grab());
 
+		exec('chmod a+r /etc/rspamd/local.d/* /etc/rspamd/override.d/*');
+		
 		$command = 'usermod -a -G amavis _rspamd';
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");