Setting the group of a Unix process

2

2

When I run:

ps -e -o pid,user,group

I see that processes have users and groups (among other properties).

How can I as a user influence the group assignment to the processes that I start?

In other words, is something like this possible?

run_as_group mygroup myserver -port 1234

where run_as_group is some standard Unix utility that takes a name of a group and a command line and executes this command line under my user name and under the given group name.

The goal that I'm trying to achieve is that a selected group of people get the permission to kill the processes that I've started.

(I'm concretely interested in Ubuntu/Debian if that matters.)

Kaarel

Posted 2012-07-19T14:47:48.023

Reputation: 131

Answers

1

You can use the newgrp command to log in to an alternative group and then run the command in that group.

Alternatively you can change the group of the executable and make the executable "setgid" (e.g. with chmod g+s myserver). This obviously has an effect on anyone running myserver and requires you to have permissions over its directory entry, wherever that is.

CB Bailey

Posted 2012-07-19T14:47:48.023

Reputation: 331

You mean chmod g+s myserver? – Kaarel – 2012-07-20T10:15:27.883

@Kaarel: Oops, yes. – CB Bailey – 2012-07-20T10:20:32.423