[asterisk-users] Running Asterisk as root

Tzafrir Cohen tzafrir.cohen at xorcom.com
Mon May 5 19:46:15 CDT 2008


On Mon, May 05, 2008 at 07:18:08PM -0500, Cesar Benjamin Garcia Martinez wrote:
> Move to root:
> 
> sudo -s
> 
> type your passwd
> 
> and as root:
> 
> 
> Edit the file /etc/init.d/asterisk
> 
> And uncommet the two lines than sasys something like 
> 
> AST_USER="asterisk"
> AST_GROUP="asterisk"
> 
> You need to create the user asterisk on your system.
> 
> And create another symlink sh to bash:
> 
> cd /bin
> rm -f sh
> ln -s bash sh 

Why is that?

Debian / Ubuntu policy is that a script that is not posix sh should use
/bin/bash. Any script of Asterisk does not fit the policy and has not
bit shot^Wfixed yet?

The fix is to edit the ofending script:

#!/bin/sh  ->  #!/bin/bash

> 
> 
> 
> Edit your /etc/asterisk/asterisk.conf and replace the line:
> 
> astrundir => /var/run 
> 
> With:
> 
> astrundir => /var/lib/asterisk/var/run

/var/run/asterisk

Everything under /var/run is deleted at boot with Ubuntu, so the init.d
script should recreate that directory and give it proper permissions if
it does not exist.

(or use the one from the Asterisk package)

> 
> Create that folder:
> 
> mkdir -p /var/lib/asterisk/var/run

/var/run/asterisk, as mentioned above. and it should be created in the
init.d script .

> 
> and, chown to asterisk:asterisk the folders:
> 
> 
> /var/lib/asterisk/
> /usr/lib/asterisk/

No real need for /usr/lib/asterisk to be owned by Asterisk. It is
read-only. /usr is read-only, as you recall.

> /var/log/asterisk/
> 
> chown -Rv asterisk:asterisk /var/lib/asterisk/
# chown -Rv asterisk:asterisk /usr/lib/asterisk/
> chown -Rv asterisk:asterisk /var/log/asterisk/
> 
> that's all
> 
> 
> 
> Btw... delete the symlink sh -> dash into /bin

NOT

> 
> Start daemon
> 
> 
> /etc/init.d/asterisk start

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-users mailing list