Asterisk as non-root

Hi. i am running pure cli asterisk 11 in debian 8 system. Up to now everything runs as root, but i would like to change it and run it as user (eg asterisk). could someone point me on what to change, please?

You have a couple of options (Option 1 is probably the option you are looking for):

  1. Using the default installation, change the owner (or give permissions) to the non-root user on those Asterisk directories that Asterisk writes too. Here is a basic description of the Asterisk directory structure. At a minimum you’ll need to change ownership to the following directories:
  • /var/lib/asterisk
  • /var/spool/asterisk
  • /var/log/asterisk
  • /var/run/asterisk
  1. Configure and install asterisk to a non-default directory that has the non-root permissions you desire. See “Installing to a custom directory” on the Building and Installing Asterisk wiki.
2 Likes

If it is a fresh system, one could set user and group to “asterisk” in asterisk.conf. If Asterisk started its life as root, then astdb.sqlite3 has also root permissions, which needs to get changed manually. Depending on the installation, the other directories might already have the correct ownership.