Run asterisk as a specified user

Hi List,

I need to run asterisk as a particular user.

If I look at the process currently started by amportal:

root 2943 0.0 0.0 2832 672 ? S 2010 0:00 /bin/sh /usr/sbin/safe_asterisk -U asterisk -G asterisk
asterisk 2948 0.2 4.9 83832 51564 ? Sl 2010 504:28 _ /usr/sbin/asterisk -f -U asterisk -G asterisk -vvvg -c

I see the user/group parameters being passed to the safe_asterisk script.

I changed


in /var/lib/asterisk/bin/freepbx_engine

The group changed but the user asterisk being run at still was asterisk.

What am i missing?

Many thanks for your help.


Change user and group in httpd.conf

To change the user asterisk is running as?

OK, I read your first post wrong.
If you need to change to another user there are a lot of places that you need to configure, like mysql database, FreePBX etc.
This is from /etc/init.d/asterisk:

# Uncomment the following and set them to the user/groups that you
# want to run Asterisk as. NOTE: this requires substantial work to
# be sure that Asterisk's environment has permission to write the
# files required  for  its  operation, including logs, its comm
# socket, the asterisk database, etc.

Thanks Mike.

I don’t have that file…

What I do have is

this references


which references


in here I have:


which I change to myuser mygroup.

It runs as mygroup but the user stays as asterisk

Thanks for you input.


I see that the user asterisk is hardcoded in freepbx_engine:

 /usr/sbin/safe_asterisk -U asterisk -G $AMPASTERISKGROUP

You could try to change that line to


Thank you very much Mikael.

Sorry I didn’t spot that…