Deploying an MapScript application (e.g. pMapper) paying attention to correct ownerships and permissions is not so straightforward as we can expect.
Here are some of the concerns we faced:
Our solution requires:
Supposed that Apache runs as the www-data user, our webmaster's name is Walter and that Walter should manage both web pages and map files, we execute:
addgroup webmasters adduser walter webmasters addgroup mapfiles adduser walter mapfiles adduser www-data mapfiles
The following is the schema of the filesystem hierachy with ownership and permissions. Where not declared, ownership and permissions are inherited from the parent folder.
DocumentRoot
|
|---- pmapper/
| Owner: user.webmasters
| Directory: drwxrwsr-x (2775)
| File: -rw-rw-r-- (0664)
| |
| \ images/legend -> ../../www-data/legend
|
\---- www-data/
Owner: root.www-data
Directory: drwxrwsr-x (2775)
File: -rw-rw-r-- (0664)
|
|---- tmp
| Temporary map images created by
| MapScript and removed by a cronjob
|
\---- legend
Temporary files from pMapper
/var/lib/mapscript/
Owner: root.mapfiles
Directory: drwxrws--- (2770)
|
\---- www.dominio.it/
Owner: root.mapfiles
Directory: drwxrws--- (2770)
Contains .map files
|
\---- file.map
Owner: utente.mapfiles
File: -rw-r----- (0640)