Asterisk.cli file permission is reset at reboot

Hi,

I’m running FreePBX 13 on a CentOS 6 VPS. All is working well, but I have one problem I can’t work out. When I reboot the VPS, I can’t apply the config because of the error: “Could not connect to remote Asterisk”. I checked

/var/run/asterisk/

To see the file permissions. When I change the ownership of the asterisk.cli file to the asterisk group, all is well. But any time I reboot those permissions are reset back to root:root.

Any idea what I’m doing wrong? Is this by design? Can I change the boot-permission setup?

After rebooting, check whether Asterisk is running as root (it should be running as asterisk).

If it’s root, there is probably a startup file left over from when you installed Asterisk (before installing FreePBX).
You can probably disable this via
chkconfig asterisk off
Now reboot and you’ll probably find that Asterisk is not running at all. If so, you need to issue
fwconsole start
at boot time to (among other things) start Asterisk properly.
A simple way is to add the command at the end of /etc/rc.local

There may be quirks in your system that are incompatible with this method. See How To Load Asterisk 13 as asterisk instead of root on CentOS 6.7 & FreePBX 13 for more details.

Thanks for the quick answer. WIll check and get back to you.

You seem to be my hero of the day. Your answer was spot on. I used
ps aux | grep asterisk
to find out that asterisk was running as root. So I used
chkconfig asterisk off
and added
fwconsole start
to the /etc/rc.local file. All seems to be working well. For anyone stumbling upon this thread, this also worked to set the permissions for voicemail files through UCP correctly.

For redhat edit /etc/sysconfig/asterisk

Foe debian edit /etc/default/asterisk

Then safe_asterisk will work as advertised

ps aux|grep asterisk

Thanks! What’s the difference between asterisk and safe_asterisk anyway?

safe_asterisk is a wrapper around asterisk, it sees if asterisk is running every $SLEEPSECS , 4 by default and restarts it if necessary. it also emails $NOTIFY , root@localhost by default when such an event happens

To explore or modify variables :-

nano $(which safe_asterisk)

1 Like

Thanks for the info! SO basically it’s meant to be sure that asterisk keeps being available after a crash?

More importantly to let you know you need to fix things, Stable Asterisk just shouldn’t and generally doesn’t crash unless you have discovered a new bug.Unfotunately, very few admins ever read the root@localhost mailbox.

But you could also fill out another e-mail here right? I have postfix setup correctly so external e-mailing is not a problem.

You can put anything your system supports which would include groups of emails and pipes to programs.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.