[asterisk-users] Access rights between AGI and Web server?

Mojo with Horan & Company, LLC mojo at horanappraisals.com
Mon Mar 24 14:05:32 CDT 2008


Vincent wrote:
> Hello
>
> 	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.
>
> 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?
>
> Thank you.
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>   
Don't forget that in PHP you have access to chown(), chgrp(), and 
chmod() -- You can change the files' permissions or uid/guid just after 
you create them.

If the AGIs do run as root:wheel, then there should be no problem, 
because they should be able to access the db files?


<?php
        $u = posix_getpwuid(posix_getuid());
        $g = posix_getgrgid(posix_getgid());
        echo "This script is running as ".$u['name'].":".$g['name'];
?>









More information about the asterisk-users mailing list