[GRASS-dev] mapset permissions: only owner should have write permissions
Markus Metz
markus.metz.giswork at gmail.com
Mon Jul 15 03:01:52 PDT 2013
On Sun, Jul 14, 2013 at 10:42 PM, Hamish <hamish_b at yahoo.com> wrote:
> Hi,
>
> Markus M:
>
>> From within GRASS, only the owner of a mapset is allowed to start a
>> GRASS session in this mapset, i.e. only the owner of a mapset has
>> write permissions to this mapset. But a new mapset being a folder in
>> the file system is created with mode 0777, thus granting write
>> permissions to all. I suggest to change mode from 0777 to 0755 in
>> G_mkdir() and add mode = 0755 in gis_set.py. Any objections?
>
> It's not created as 777 (I would have noticed that :), that's before
> the umask. So for me it gets created as drwxr-xr-x, as expected.
For me, it gets created as drwxr-xr-x too, but this depends on umask.
G_mkdir() calls (on anything but windows) mkdir(path, 0777) [0]
>
> $ man 2 mkdir:
>
> """
> The argument mode specifies the permissions to use. It is modified by
> the process's umask in the usual way: the permissions of the created
> directory are (mode & ~umask & 0777). Other mode bits of the created
> directory depend on the operating system.
man 2 umask:
"The typical default value for the process umask is S_IWGRP | S_IWOTH
(octal 022)"
which results in the desired drwxr-xr-x permissions. I could not find
information on "typical", and this "typical" might be different on
different systems. I suggest to make sure that the permissions are
really drwxr-xr-x by using "mkdir(path, 0755);".
Markus M
[0] https://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/paths.c#L32
> [...]
> NOTES
> Under Linux apart from the permission bits, only the S_ISVTX mode bit
> is honored. That is, under Linux the created directory actually gets
> mode (mode & ~umask & 01777). See also stat(2).
> """
>
>
> Hamish
>
More information about the grass-dev
mailing list