This is a suid program for creating greenstone folders in users' home folders.
It should be owned by root:tomcat, and have the SUID bit set, i.e.

  sudo chown root:tomcat7 ./gs-mkdir
  sudo chmod u+s ./gs-mkdir

Build with:

  gcc -o gs-mkdir gs-mkdir.c -lacl

When given a valid username, it will create a 'Greenstone' folder in that
user's home folder, chown it to be owned by that user, and use ACL (Access
Control Lists) to allow both Tomcat and the given user to read and write files
in that folder.

In order for Tomcat to access the user's Greenstone folder, it also has to be
able to traverse the directories leading to it (i.e. /home/<user>/).
To do this, the executable bit must be set on those directories. The following
permissions will work:

  drwx--x--x

Explanation:
The read permission on a directory allows listing the files in that directory.
The execute permission on a directory allows traversing to a known file in that
directory (i.e. if a directory is executable, but not readable, you can only
get to files that you know the name of).
Since we know the name of the Greenstone folder, we can get to it directly, and
don't need read permissions on the user's home folder.