[asterisk-users] Access rights between AGI and Web server?
Steve Edwards
asterisk.org at sedwards.com
Sun Mar 23 21:08:37 CDT 2008
On Sun, 23 Mar 2008, Vincent wrote:
> I run AGI scripts from extensions.conf to save data into an SQLite
> database file, but this file must also be accessible in read-write
> mode by PHP scripts served by Lighttpd.
>
> As far as I can tell, Asterisk runs by default as root:wheel. I don't
> know if AGI scripts also run as root:wheel.
On BSD? On my CentOS box, Asterisk runs as root:root. Since AGI's are
separate processes created by Asterisk, they also run as root:root.
> Lighttpd runs as www:www, and if I create a new SQLite database
> through PHP scripts, they're created as www:wheel.
>
> What do you recommend I do so both AGI scripts and PHP scripts can
> work with a common SQLite file? Should I run Asterisk as www:www,
> www:wheel? Something else?
Since the AGI is already running as root, why can't it access the SQLite
data file?
Try creating /var/lib/asterisk/agi-bin/test containing:
#!/bin/bash
set >/tmp/test
Execute "chmod +x /var/lib/asterisk/agi-bin/test" so it can be executed.
Cobble up a dialplan to execute "agi(test)."
What does
ls -l /tmp/test
look like?
Mine looks like:
-rw-r--r-- 1 root root 623 Mar 23 18:51 /tmp/test
What does
cat /tmp/test
look like?
Mine looks like:
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=([0]="0")
BASH_SOURCE=([0]="/var/lib/asterisk/agi-bin/test")
BASH_VERSINFO=([0]="3" [1]="00" [2]="15" [3]="1" [4]="release" [5]="i686-redhat-linux-gnu")
BASH_VERSION='3.00.15(1)-release'
DATABASE-DATABASE=
DATABASE-PASSWORD=
DATABASE-SERVER=
DATABASE-USER=
DIRSTACK=()
EUID=0
GROUPS=()
HOST=foo
HOSTNAME=foo.sedwards.com
HOSTTYPE=i686
IFS=$' \t\n'
MACHTYPE=i686-redhat-linux-gnu
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/bin/:/bin/
PPID=8435
PS4='+ '
PWD=/tmp
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=1
TERM=dumb
UID=0
_=/bin/bash
Thanks in advance,
------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list