Web Page Ownership

Some web pages are confidential. Not everybody can/must have access to them. You can limit web access to them by means of the access control mechanisms described on the other pages in this section. You can/must also limit access to them by means of NFS/file ownership and access rights.

Personal Web Directories

For this, some special directories are/can be created in your web directory:

  • /cw/w3people/firstname.lastname/private
  • /cw/w3people/firstname.lastname/public_html/private

The public_html/private directory must contain files/directories that must be accessible as a web page/document, but must not be readable via NFS for others. Typically these files/directories are protected by means of a web-access mechanism as described here. In this way, these files directories are only accessible via the web server and moreover, only for authorized visitors.

The private directory must contain files/directories that are not to be served (as web page/document) by the web service. Typically these are password-files for use in an access-limited web-directory (cfr. the public_html/private directory above) or php-include files or ...

Both private directories have the below characteristics:

    drwx--x--- 2 loginname www-data 4096 2008-10-21 10:47 private
    drwx--x--- 2 loginname www-data 4096 2008-10-21 10:47 public_html/private

This means that:

  • you as owner can do anything you need in/with those directories.
  • members of the group www-data have directory access.
    (www-data is the primary group of the account that executes the web service and only that account is a member of that group)
  • others have no access at all.

The files/sub-directories you create in those private directories are only accessible to yourself and the web server. Moreover, the web server cannot do a listing of a directory, but must know the exact file/directory name to access. This is not a problem because you must refer to the exact file/directory by name whenever using it in a php script or .htaccess file anyway.

Just remember to make files/sub-directories in the private directories readable for the web server ... in practice this means make them readable for others/world. This is not a problem because others cannot access the private directory at all, so the files/sub-directories in them are not accessible, regardless of the access rights on them.

Group Web Directories

For research group web pages and other web directories maintained by a group of users, similar directories can be created:

    d--xrws--- 2 www-data group 4096 2008-10-21 10:47 private
    d--xrws--- 2 www-data group 4096 2008-10-21 10:47 public_html/private
    

If you need such a directory, just ask helpdesk to create them.

If you use the new php-suexec infrastructure, there is also a directory that is only accessible from within that php-suexec context:

    d--xrws--- 2 phpsuexecaccount group 4096 2008-10-21 10:47 php
or:
    drwx--x--- 2 youraccount phpsuexecgroup 4096 2008-10-21 10:47 php

The meaning and intention are exactly the same as for the private directory: only the maintainers of the web site (the members of the group or the owner) have read/write-access and besides them, only the php-suexec-account has read-access:

  • If you want something to be available for just the web-service (but not php), you put it in private:
    • e.g. password file for basic authentication via .htaccess
  • If you want something to be available for just the php scripts, you put it in php:
    • e.g. include file with credentials for access to a database
  • We have not seen an example of something that needs to be available for both the web-service and the php scripts but not for others