How To Load Asterisk 13 as asterisk instead of root on CentOS 6.7 & FreePBX 13

I have followed the following FreePBX how-to on installing FreePBX 13 on CentOS 6.X. (Link omitted since I am a new user and will not allow me to post a link)

All is well and everything runs fine however every time I reboot the OS Asterisk 13 loads as root.root instead of asterisk.asterisk causing me to have to go into the CLI, shutdown Asterisk and then run “/usr/src/freepbx/start_asterisk start” in order for the UI to operate properly.

Could someone please assist me with how I can load Asterisk at boot as asterisk.asterisk instead of root.root?

Thanks.

Also changing /usr/sbin/asterisk binary to asterisk.asterisk did not help.

How is asterisk getting started on boot?

Appears to be starting from /etc/init.d/asterisk at this point. I have looked through that script and do not seem to find a way to have it load as a different user then root.

Ideally you’d want to disable the asterisk startup script and create a startup script for

fwconsole start

As root. Since fwconsole start will start asterisk as the defined user.

Sounds like a working start. Will try that after work today :smiley:

Thanks for the assistance. Little rusty with Linux so that brings back old memories now and I think I can handle that.

I have now had the exact same issue - found several threads that sounded promising, but didn’t fix. Would love to hear what works for you. And if your Linux is rusty, mine is downright pathetic. :slightly_smiling:

I’m also getting several alerts in the dashboard about modules not being owned by “asterisk”, despite the fact I’ve run the “fwconsole chown” command several times, as well as manually changed recursive permissions on the affected directories:
File /etc/modprobe.d/dahdi.conf is not owned by asterisk
File /etc/dahdi/modules is not owned by asterisk

Quite annoying…

If you dont plan on using DADHI just disable the module in connectivity on the module admin. Thats only used for physical hardware and not SIP. Fixed the errors for me because I didn’t compile the DADHI modules.

That was only an example - I had several that popped up. The built-in permissions repair didn’t correct (had to manually do it - very odd). The other odd one I’m seeing is “no conference room app”, yet the conference module is installed and the newer module is selected in Advanced Settings (the newer app_confbridge one).

However, I’ve dug around every place I know to trying to find what would make it start as ROOT each time and I’ve been unable to find it. I don’t even see where FPBX is starting in the first place, let alone Asterisk.

I will say, that is the one frustrating thing about the step-by-step instructions - they’re supposed to have a working system when complete, but I’m thinking there’s something missing we have to make some of these edits. I also had to edit some of the commands for the big set of “yum install” commands - several items were missed and I had to issue the install commands one by one. I’m thinking it’s the addition of a MAKE command in the middle of the string, but can’t be sure.

And as I was writing this, I blundered across something that works:

chkconfig asterisk --list
asterisk 0:off 1:off 2:on 3:on 4:on 5:on 6:off
chkconfig --level 0123456 asterisk off
chkconfig asterisk --list
asterisk 0:off 1:off 2:off 3:off 4:off 5:off 6:off
reboot

This stops Asterisk from auto-booting. Now you just have to issue a “fwconsole start” command on bootup:
vi /etc/rc.local
<at end of file put “fwconsole start”>

I have no doubt there’s a better (more proper) way to do it because I really wasn’t kidding about having weak linux skills - all of this was put together from other instruction-lettes, so I’m open to any “are you crazy” comments. :slightly_smiling:

My only concern is, are there other services that should be run by “asterisk” that are also being run by root (such as, fail2ban)…

If you have weak Linux skills we advise you use the distro

I’m not familiar with CentOS 6.7, but this is what I do using Debian 7 & Debian 8:

  1. Create /etc/init.d/pbx-start containing (the forum software butchered the formatting):

=====

#!/bin/bash

### BEGIN INIT INFO
# Provides: pbxstart
# Required-Start: $network $syslog $named $local_fs $remote_fs
# Required-Stop: $network $syslog $named $local_fs $remote_fs
# Should-Start: mysql
# Should-Stop: mysql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: FreePBX Startup
# Description: FreePBX Startup
### END INIT INFO

case "$1" in
start)
/usr/sbin/fwconsole start
;;
stop)
;;
*)
echo "Usage: /etc/init.d/pbx-start {start|stop}"
exit 1
;;
esac

exit 0

=====

  1. Run: chmod +x /etc/init.d/pbx-start

  2. Run: update-rc.d -f asterisk remove

  3. Run: update-rc.d pbx-start defaults