You are on page 1of 7

COMMANDS TO MANAGE GROUPS

1. groupadd
NAME

groupadd - Create a new group

SYNOPSIS

groupadd [-g gid [-o]] [-r] [-f] group

DESCRIPTION

The groupadd command creates a new group account using the values
specified on the command line and the default values from the system.
The new group will be entered into the system files as needed. The
options which apply to the groupadd command are

-g gid

The numerical value of the group's ID. This value must be unique,
unless the -o option is used. The value must be non-negative. The
default is to use the smallest ID value greater than 500 and greater than
every other group. Values between 0 and 499 are typically reserved for
system accounts.

-r

This flag instructs groupadd to add a system account. The first available
gid lower than 499 will be automatically selected unless the -g option is
also given on the command line.
This is an option added by Red Hat.

-f
This is the force flag. This will cause groupadd to exit with an error
when the group about to be added already exists on the system. If that
is the case, the group won't be altered (or added again).
This option also modifies the way -g option works. When you request a
gid that it is not unique and you don't specify the -o option too, the
group creation will fall back to the standard behavior (adding a group as
if neither -g or -o options were specified).
This is an option added by Red Hat.

2. groupdel
NAME

groupdel - Delete a group  

SYNOPSIS

groupdel group  

DESCRIPTION

The groupdel command modifies the system account files, deleting all
entries that refer to group. The named group must exist.

You must manually check all filesystems to insure that no files remain
with the named group as the file group ID.  

3. groups
NAME
groups - print the groups a user is in
SYNOPSIS
groups [OPTION]... [USERNAME]...

DESCRIPTION
--help display this help and exit

--version
output version information and exit

Same as id -Gn. If no USERNAME, use current process.

4. chgrp
NAME

chgrp - change group ownership  

SYNOPSIS

chgrp [OPTION]... GROUP FILE...


chgrp [OPTION]... --reference=RFILE FILE...  

DESCRIPTION

Change the group membership of each FILE to GROUP.

-c, --changes

like verbose but report only when a change is made

--dereference

affect the referent of each symbolic link, rather than the symbolic link
itself
-h, --no-dereference

affect symbolic links instead of any referenced file (available only on


systems that can change the ownership of a symlink)

-f, --silent, --quiet

suppress most error messages

--reference=RFILE

use RFILE's group rather than the specified GROUP value

-R, --recursive

operate on files and directories recursively

-v, --verbose

output a diagnostic for every file processed

--help

display this help and exit

--version

output version information and exit

5. newgrp
The newgrp command is used to change the current group ID during a
login session.

NAME
newgrp - log in to a new group
SYNOPSIS
newgrp [-] [group]

DESCRIPTION
The newgrp command is used to change the current group ID during a
login session. If the optional - flag is given, the user´s environment will
be reinitialized as though the user had logged in, otherwise the current
environment, including current working directory,remains unchanged.

6. chown
NAME

chown - change file owner and group

SYNOPSIS

chown [OPTION]... OWNER[:[GROUP]] FILE...


chown [OPTION]... :GROUP FILE...
chown [OPTION]... --reference=RFILE FILE...

DESCRIPTION

This manual page documents the GNU version of chown. chown


changes the user and/or group ownership of each given file, according
to its first non-option argument, which is interpreted as follows. If only
a user name (or numeric user ID) is given, that user is made the owner
of each given file, and the files' group is not changed. If the user name
is followed by a colon or dot and a group name (or numeric group ID),
with no spaces between them, the group ownership of the files is
changed as well. If a colon or dot but no group name follows the user
name, that user is made the owner of the files and the group of the files
is changed to that user's login group. If the colon or dot and group are
given, but the user name is omitted, only the group of the files is
changed; in this case, chown performs the same function as chgrp.

OPTIONS

Change the owner and/or group of each FILE to OWNER and/or GROUP.

-c, --changes

like verbose but report only when a change is made

--dereference

affect the referent of each symbolic link, rather than the symbolic link
itself

-h, --no-dereference

affect symbolic links instead of any referenced file (available only on


systems that can change the ownership of a symlink)

--from=CURRENT_OWNER:CURRENT_GROUP

change the owner and/or group of each file only if its current owner
and/or group match those specified here. Either may be omitted, in
which case a match is not required for the omitted attribute.

-f, --silent, --quiet

suppress most error messages

--reference=RFILE

use RFILE's owner and group rather than the specified OWNER:GROUP
values
-R, --recursive

operate on files and directories recursively

-v, --verbose

output a diagnostic for every file processed

--help

display this help and exit

--version

output version information and exit

Owner is unchanged if missing. Group is unchanged if missing, but


changed to login group if implied by a `:'. OWNER and GROUP may be
numeric as well as symbolic.

You might also like