이 콘텐츠는 선택한 언어로 제공되지 않습니다.

3.5. Managing Groups via Command-Line Tools


Groups are a useful tool for permitting co-operation between different users. There is a set of commands for operating with groups such as groupadd, groupmod, groupdel, or gpasswd. The files affected include /etc/group which stores group account information and /etc/gshadow, which stores secure group account information.

3.5.1. Creating Groups

To add a new group to the system with default settings, the groupadd command is run at the shell prompt as root.
groupadd group_name

Example 3.18. Creating a Group with Default Settings

~]# groupadd friends
The groupadd command creates a new group called friends. You can read more information about the group from the newly-created line in the /etc/group file:
classmates:x:30005:
Automatically, the group friends is attached with a unique GID (group ID) of 30005 and is not attached with any users. Optionally, you can set a password for a group by running gpasswd groupname.
Alternatively, you can add command options with specific settings.
groupadd option(s) groupname
If you, for example, want to specify the numerical value of the group's ID (GID) when creating the group, run the groupadd command with the -g option. Remember that this value must be unique (unless the -o option is used) and the value must be non-negative.
groupadd -g GID

Example 3.19. Creating a Group with Specified GID

The command below creates a group named schoolmates and sets GID of 60002 for it:
~]# groupadd -g 60002 schoolmates
When used with -g and GID already exists, groupadd refuses to create another group with existing GID. As a workaround, use the -f option, with which groupadd creates a group, but with a different GID.
groupadd -f GID
You may also create a system group by attaching the -r option to the groupadd command. System groups are used for system purposes, which practically means that GID is allocated from 1 to 499 within the reserved range of 999.
groupadd -r group_name
For more information on groupadd, see the groupadd(8) man pages.
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.