multi-user changes to grass

Anthony Anger geaa at
Tue Mar 15 02:15:12 EST 1994

	   in our use of Grass here at James Cook University
(Australia), rather than having all the grass users (both students and
academic staff), storing their information under the grass data area, we
endeavoured to find a way in that the users' data could be stored in
their own areas, yet still be accessed in the normal way from grass.  In
the end, a system by which the users' mapsets were symbolically linked
to a subdirectory under their own home directories.  

  The system was implemented by modifying the grass shell script, and
also creating one small C program.  This program should be setgid (set
group-id) to whatever user group the data is stored as.  The location
directories' permissions should be set writable by the group.   I will
append the relevant code below...  We will most likely modify the xgrass
shell script in a similar manner.

  What we were wondering though, was if anybody else had come across a
similar situation, and if so, how they had handled it.  We would love to
hear from you with any comments.  

  Also, we are also trying to figure out a (preferably simple :) ) way
to give each xgrass user their own unique set of monitors.  Does anybody
have any suggestions??  We would love to hear from you in either case.



 -- grass4.1 shell script --

#!/bin/sh -x

# grass 4.1 execution script - setup for

export GISBASE

#  --
# Local modifications:

GRASSUSER=`whoami` || exit 1

for i in $GRASSDATA/*

  if [ -d $i ]
    then	# perform this only on real locations (directories)

      LOCATION=`basename $i`

	# if no directory or symbolic link currently exists...
      if [ ! -h $GRASSDATA/$LOCATION/$GRASSUSER -a ! \
	# create a directory in their $HOME dir if it doesn't exist
          if [ ! -d $HOME/ ]
              mkdir $HOME/ || exit 1;

	# create location in their own grass database
          if [ ! -d $HOME/$LOCATION ]
              mkdir $HOME/$LOCATION || exit 1;

	# symbolically link their database into the main grass database



#  --

exec $GISBASE/etc/

 -- end of grass4.1 shell script --


 -- symlink.c source code --

/* symlink.c */

  Author: Anthony Anger  (Anthony.Anger at
  Created: 3/3/94

/* this program has been created to run setgid and create symbolic links in 
  the directories (of course it can just be used to create 
  symbolic links, if you wish... 	*/

main( int argc, char *argv[] )
  if ( argc != 3 )
      printf("\n  Usage: %s <symbolic link name> <link destination>\n", 
		argv[0] );
      printf( "\nThis program creates a sybolic link which is named by ");
      printf("the first parameter.\nThe interpreted destination of the");
      printf(" symbolic link is given by the second parameter.  \n");

  if ( symlink( argv[2], argv[1] ) < 0 )
   else exit(0);

 -- end of symlink.c source code --


Anthony Anger 
Anthony.Anger at

More information about the grass-dev mailing list