List:
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
.
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? I'm trying to avoid requiring everyone to create their own login/MAPSET and have the resulting files (which we want to retain as an archive) scattered around in different MAPSETS.
Thanks,
Tom
--
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177
EMAIL: thomas.adams@noaa.gov
VOICE: 937-383-0528
FAX: 937-383-0033
Thomas Adams 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.
--
Glynn Clements <glynn@gclements.plus.com>
Glynn,
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.
Regards,
Tom
----- Original Message -----
From: Glynn Clements <glynn@gclements.plus.com>
Date: Sunday, October 28, 2007 11:12 pm
Subject: Re: [GRASS-user] Question about MAPSET permissions with a GRASS script
Thomas Adams 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.
--
Glynn Clements <glynn@gclements.plus.com>
Thomas.Adams@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@gclements.plus.com>