I have a unix id that has group1 for a primary group, and group2, group3,
and group4 for supplementary groups. I'd like to change my primary group
before running certain commands. So sometimes I might want group2 to be
the primary group, and other times group3 or group4.
I saw the posix module's setgid method, but it failed for me unless I was
running as root. Also it only accepts the gid, but I'd rather pass in
the group name, or somehow lookup the gid based on the name.
Does anyone know a way to do all of this?
Thanks much.
-Justin 3 6259
"Justin Johnson" <ju***********@fastmail.fm> wrote in message news:<ma**********************************@python. org>... I have a unix id that has group1 for a primary group, and group2, group3, and group4 for supplementary groups. I'd like to change my primary group before running certain commands. So sometimes I might want group2 to be the primary group, and other times group3 or group4.
I saw the posix module's setgid method, but it failed for me unless I was running as root. Also it only accepts the gid, but I'd rather pass in the group name, or somehow lookup the gid based on the name.
Does anyone know a way to do all of this? Thanks much. -Justin
These are not python solution;
1) make a setgid script and put your commands there, or
2) use shell commands;
echo "command1; command2;" | newgrp group2
-Inyeol
Thanks. I was hoping for a python solution though. :-( Does anyone
know of a way to do this in python?
On 13 Aug 2003 08:52:40 -0700, "Inyeol Lee" <In********@yahoo.com> said: "Justin Johnson" <ju***********@fastmail.fm> wrote in message news:<ma**********************************@python. org>... I have a unix id that has group1 for a primary group, and group2, group3, and group4 for supplementary groups. I'd like to change my primary group before running certain commands. So sometimes I might want group2 to be the primary group, and other times group3 or group4.
I saw the posix module's setgid method, but it failed for me unless I was running as root. Also it only accepts the gid, but I'd rather pass in the group name, or somehow lookup the gid based on the name.
Does anyone know a way to do all of this? Thanks much. -Justin
These are not python solution;
1) make a setgid script and put your commands there, or 2) use shell commands;
echo "command1; command2;" | newgrp group2
-Inyeol -- http://mail.python.org/mailman/listinfo/python-list
Okay, I'll have to do some more research. Maybe I *will* have to run the
script setuid root. Shucks! Thanks for the grp.getgrnam help. Just
what I needed. :-)
On Wed, 13 Aug 2003 14:11:01 -0500, "Jeff Epler" <je****@unpythonic.net>
said: On Wed, Aug 13, 2003 at 12:10:02PM -0600, Justin Johnson wrote: Thanks. I was hoping for a python solution though. :-( Does anyone know of a way to do this in python?
Unix doesn't let you setgid() to groups in the supplemental group list without the same permission needed to change to any group.
But depending what you need to do, you might be able to use set-group-id directories. For instance, if I am group g1 and have a group list [g1, g2, g3], then I can read files readable by any of those groups, and create files in directories writable by any of those groups. But if you make a directory d2 that is setgid g2 and d3 setgid g3, then when I create a file in d2 it will belong to group g2.
Barring that, you could modify the setgid() call in the kernel, to permit the change if the requested group is in the auxiliary group list. It looks like something you could do in an afternoon if you have the source for your kernel (bsd, linux, etc) and can program C.
"Justin Johnson" <ju***********@fastmail.fm> wrote in message news:<ma**********************************@python. org>... Also [setgid] only accepts the gid, but I'd rather pass in the group name, or somehow lookup the gid based on the name.
See grp.getgrnam(). Example: >>> grp.getgrnam("utmp")
('utmp', 'x', 22, [])
Jeff This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: lawrence |
last post by:
> If anything, set up PHP to run as the user that owns htdocs, rather
> than the other way around, it is somewhat safer that way, unless PHP
> requires root permissions
I ran a search on Google...
|
by: Tim Daneliuk |
last post by:
OK, I've Googled for this and cannot seem to quite find what I need.
So, I turn to the Gentle Geniuses here for help. Here is what I
need to do from within a script:
Given a username and a...
|
by: Brandon Hoppe |
last post by:
I'm trying to change the src of an ilayer in the parent document from a link inside the
ilayer. I'm not able to get it to work. All that happens is Netscape 4 crashes. This is
for Netscape 4 only....
|
by: labzilla |
last post by:
I want to modify the value of $@ so that
if( $@ ) becomes a true statement.
Sorry if this is a newbie question.
|
by: 101 |
last post by:
Taking a course on SQL. They are saying you can get better performance by
having multiple files for a group.
They then graphically show an example of "Primary" with multiple data files.
I have...
|
by: Thomas A. Anderson |
last post by:
I am a bit confused in creating a composite primary key. I have three table
with two of the tables containing primary keys. I have two of the tables
(each with a primary key) having one to many...
|
by: Nonoize |
last post by:
Hi all,
Really dumb question but I don't know how to resolve it. Looked in help and
evry book I have.
I have a table where the primary key was set as an Integer and its reached
over 140K...
|
by: LurfysMa |
last post by:
Most of the reference books recommend autonum primary keys, but the
Access help says that any unique keys will work.
What are the tradeoffs?
I have several tables that have unique fields. Can...
|
by: Derek Peschel |
last post by:
Should I add an RFE to SourceForge too? I'd like a wide audience in case
someone has enough experience to comment or is solving the same problem.
I'm using the urwid library which uses curses. ...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |