[GRASS-user] Question about MAPSET permissions with a GRASS script

Glynn Clements glynn at gclements.plus.com
Mon Oct 29 18:58:26 EDT 2007


Thomas.Adams at noaa.gov wrote:

> > > I have written a GRASS shell script for Linux that works perfectly well 
> > > except for one thing. Anyone who runs it from their login ID must be 
> > > able to run the script, which they initiate manually. The MAPSET is 
> > > generic, called 'oper' � we have an 'oper' Linux login. What happens is 
> > > that unless I login or 'su' to 'oper', the script fails with:
> > > 
> > > ERROR: MAPSET oper � permission denied
> > > ERROR: MAPSET oper � permission denied
> > > ERROR: MAPSET oper � permission denied
> > > .
> > > .
> > > .
> > > etc.
> > > 
> > > The process involves (among other things) reading in point data using 
> > > v.in.ascii and spatially interpolating it to a raster.
> > > 
> > > I have tried a number of things to set the GRASS permissions to allow 
> > > universal access to the 'oper' MAPSET as well as trying to export the 
> > > USER variable, etc. Nothing seems to work. Does anyone have a 
> > > suggestion?
> > 
> > GRASS requires that you own the current mapset. 
> > 
> > If you want to avoid this, you need to remove the check from
> > G__mapset_permissions() in lib/gis/mapset_msc.c.
> 
> Thanks, but I don't want to break that feature in GRASS. I suppose I
> was hoping that someone might have a suggestion as to how I might set
> an environment variable or do something in my script that would set
> the login ID to 'oper' that GRASS would recognize as legitimate. 
> Someone I work with suggested that some use of 'expect' might work;
> so, I am playing with that approach.

You could probably use expect to script logging in as "oper".

The ownership check is performed using the process' UID, so you need
to actually become the "oper" user by some means, whether by logging
in, su, sudo, or a setuid executable.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-user mailing list