OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

5.2.4. Managing Unix Groups‌


The addgroup and delgroup commands add or delete a group, respectively. The groupmod com- mand modifies a group’s information (its gid or identifier). The command gpasswdgroup changes the password for the group, while the gpasswd -r group command deletes it.


Working with Several Each user may be a member of many groups. A user’s main group is, by default, Groups created during initial user configuration. By default, each file that a user creates belongs to the user, as well as to the user’s main group. This is not always desirable;

for example, when the user needs to work in a directory shared by a group other than their main group. In this case, the user needs to change groups using one of the following commands: newgrp, which starts a new shell, or sg, which simply executes a command using the supplied alternate group. These commands also allow the user to join a group to which they do not currently belong. If the group is password protected, they will need to supply the appropriate password before the command is executed.

Alternatively, the user can set the setgid bit on the directory, which causes files cre- ated in that directory to automatically belong to the correct group. For more details, see sidebar “setgid directory and sticky bit” [page 58].

The id command displays the current state of a user, with their personal identifier (uid variable), current main group (gid variable), and the list of groups to which they belong (groups variable).

Working with Several Each user may be a member of many groups. A user’s main group is, by default, Groups created during initial user configuration. By default, each file that a user creates belongs to the user, as well as to the user’s main group. This is not always desirable;

for example, when the user needs to work in a directory shared by a group other than their main group. In this case, the user needs to change groups using one of the following commands: newgrp, which starts a new shell, or sg, which simply executes a command using the supplied alternate group. These commands also allow the user to join a group to which they do not currently belong. If the group is password protected, they will need to supply the appropriate password before the command is executed.

Alternatively, the user can set the setgid bit on the directory, which causes files cre- ated in that directory to automatically belong to the correct group. For more details, see sidebar “setgid directory and sticky bit” [page 58].

The id command displays the current state of a user, with their personal identifier (uid variable), current main group (gid variable), and the list of groups to which they belong (groups variable).


Top OS Cloud Computing at OnWorks: