D. J. Bernstein
Internet publication
publicfile

User's guide

Where public files are stored

publicfile makes files available from a public file area, typically /public/file. You can use the public file area if your system administrator has made a public directory for you somewhere inside /public/file; for example, /public/file/0/users/you.

You can set up a symbolic link from ~you/public to your public directory. Your system administrator may have already done this for you.

Publishing files

To make a file publicly available through publicfile, copy it to your public directory:
     cp r.ps public/report.ps
You can also create and edit files directly inside the public file area:
     cd public
     vi report.html
Beware that if someone downloads report.html the moment that you finish creating or editing it, the downloaded copy may be truncated. You can eliminate this risk by editing temporary copies of files and moving them into place with mv when they are complete:
     cp report.html report.html.new
     vi report.html.new
     mv report.html.new report.html
You can set up directories, symbolic links, etc. inside your public directory. Beware, however, that symbolic links pointing outside the public file area will not work.

Note that the name of a file controls its file type.

Permissions

Your umask may be set up so that files are not world-readable by default. If so, you must change the permissions of your public files so that publicfile can read them:
     chmod go+r public/report.ps
Similarly, if your directories are not world-executable by default, you must change their permissions:
     chmod go+x public/old-reports
If you create a world-readable directory, publicfile will allow FTP clients to see a list of files in that directory:
     chmod go+r public/old-reports
The list excludes names that contain spaces, tildes, or control characters.

In some cases you may want to make a file available to local users in the public file area without making it available through publicfile. You can do this by making the file world-executable but not user-executable:

     chmod o+x public/tentative.ps
     chmod u-x public/tentative.ps
publicfile will pretend that it can't read the file. Or you can use a filename beginning with a dot; publicfile converts leading dots to colons when it looks for files.

File URLs

publicfile is normally configured so that the file /public/file/0/users/you/report.html is available through both HTTP and FTP:
     http://host/users/you/report.html
     ftp://host/users/you/report.html
publicfile also supports virtual hosts through HTTP. The file /public/file/vhost/report.html can be reached by the URL
     http://vhost/report.html
if vhost has an appropriate DNS A record.

publicfile automatically adds index.html to any HTTP URL ending with a slash (or containing just a host name), so

     http://vhost
     http://vhost/
     http://vhost/index.html
all refer to /public/file/vhost/index.html.