Auto Start Asterisk Wont Save Recordings

In my Dialplan I have MixMonitor which records to external HDD thats mount to /Records with permission 775 Root:Root

When my server boots up and auto start asterisk, while calling it says permission denied
but if I stop that instance and run asterisk as
sudo asterisk -cvvv it works when calling.

I dont understand if asterisk is running as root why cant it create the file/folder?

image

SELinux? That applies even to root.

I dont understand? How can I fix this? I want asterisk to be able to boot automatically and still create the file/folder when it records.

Google SELinux.

If it is SELinux, the simplest work round is to disable SELinux, but if you need SELinux, you will need to configure it properly for this case.

Thanks! I check status of SELinux with the following command

#sestatus

then I temporary disable SELinux with

#setenforce 0

and when I ran the program it worked, so conclusion, SELinux is the problem

I set SELinux back on with

#setenforce 1

Now I need to find out how to allow root with loading Asterisk to keep Root Privilege