Re: program that runs a given command under a given gid
From:
Jann Horn
Subject:
Re: program that runs a given command under a given gid
Date:
Sat, 26 May 2012 15:32:52 +0200
User-agent:
Mutt/1.5.21 (2010-09-15)
On Sat, May 26, 2012 at 03:10:02PM +0200, Bruno Haible wrote:
> Hi,
>
> Is there a program that runs a given command with the identity changed
> to a given group id? Like 'sudo' does for the uid, but for the gid instead.
> Does such a program exist?
From the sudo manpage:
-g group Normally, sudo sets the primary group to the one specified
by the passwd database for the user the command is being run as (by default,
root). The -g
(group) option causes sudo to run the specified command with
the primary group set to group. To specify a gid instead of a group name, use
#gid. When
running commands as a gid, many shells require that the '#'
be escaped with a backslash ('\'). If no -u option is specified, the command
will be run as
the invoking user (not root). In either case, the primary
group will be set to group.