Activate changes: Permission denied error
Receiving permission denied error while activating changes.
LAST TESTED ON CHECKMK 2.3.0P1
Problem
After an omd copy/move from the command line or the Checkmk appliance, you may be unable to activate changes due to this error:
The above snip is just to exemplify the "Permission denied:" problem. The below excerpt is from a different host, but the problem is similar ("Permission denied:").
In this case, the error was caused by some wrong permissions:
OMD[mysiteNEW]:~/var/agent-receiver/received-outputs$ ls -ltr total 320 lrwxrwxrwx 1 mysiteOLD mysiteOLD 69 Nov 25 11:31 3e03abe9-7cee-4b65-bd00-aacc64114248 -> /omd/sites/mysiteOLD/tmp/check_mk/data_source_cache/push-agent/host1 lrwxrwxrwx 1 mysiteOLD mysiteOLD 69 Nov 25 11:31 381bd3f2-2250-42d3-aafc-afed3eda708d -> /omd/sites/mysiteOLD/tmp/check_mk/data_source_cache/push-agent/host2 lrwxrwxrwx 1 mysiteOLD mysiteOLD 69 Nov 25 11:31 33f0b013-6a53-4bbb-ba44-15750b09c43e -> /omd/sites/mysiteOLD/tmp/check_mk/data_source_cache/push-agent/host3 lrwxrwxrwx 1 mysiteOLD mysiteOLD 68 Nov 25 11:31 32e8c449-d31d-4db6-a6cc-2f61e57d74a2 -> /omd/sites/mysiteOLD/tmp/check_mk/data_source_cache/push-agent/host4 lrwxrwxrwx 1 mysiteOLD mysiteOLD 69 Nov 25 11:31 3257d465-5737-4e25-9e42-0d8792992ad7 -> /omd/sites/mysiteOLD/tmp/check_mk/data_source_cache/push-agent/host5 lrwxrwxrwx 1 mysiteOLD mysiteOLD 73 Nov 25 11:31 3157b60f-5ad1-4c4e-b1c3-d132da075f96 -> /omd/sites/mysiteOLD/tmp/check_mk/data_source_cache/push-agent/host6
The below files should be owned by the user and group mysiteNEW, not mysiteOLD.
Below, we will fix this.
Solution
If your site is equal to or higher than 2.1
- The encountered problem is covered in Werk #13312.
Since the error is generated by the fact that some files inside the checkmk site are not owned by the site user, you can use find to identify all the existing files with wrong permissions
Execute the following command as root:
find /omd/sites/mysiteNEW -not -user mysiteNEW
Depending on your findings, you can change the permissions of the files, like this:
chown mysiteNEW:mysiteNEW /omd/sites/mysiteOLD/tmp/check_mk/data_source_cache/push-agent/host1
Repeat for all of the hosts that were moved to the new site, or use a wildcard:chown mysiteNEW:mysiteNEW /omd/sites/mysiteOLD/tmp/check_mk/data_source_cache/push-agent/host*
Related articles