executing newgrp from python in current shell possible?

Svenn Are Bjerkem svenn.bjerkem at googlemail.com
Wed Jan 9 08:56:31 EST 2008


Hi,
as a user on a linux system I am member of the groups "users" and
"design" with users as my default group. To controll the accessibility
of some parts of the file system, creation of files and directories in
those parts must be done with group "design". This is currently done
manually with "newgrp design" on the command line before doing
anything else. I have been looking for a way to execute this command
as a part of a script, but it seems that the changes are only valid in
the context of the script and when the script exits, the current shell
still have the original "users" group setting. It looks like the
command spawns a new command line in the context of the current xterm
as I get back to my old command line when exiting (instead of the
xterm dissapearing)

A possible alternative could be to have the python script launch a new
shell, but I still have the problem to set the group id for that new
shell (lack of python knowledge). I am happy for any advice. Maybe it
is simply not possible to do this kind of operation from a script in
python on linux.

--
kind regards,
Svenn



More information about the Python-list mailing list