chgroup 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-chgroup
핵심 정리
- 그룹 속성을 바꿉니다.
chgroup 속성=값 ... 그룹. 속성 하나라도 틀리면 아무것도 바꾸지 않습니다. - 주요 속성:
users(구성원),adms(그룹 관리자),admin(관리 그룹 여부),id(GID, 바꾸지 않는 것이 좋음),projects. users=는 목록 전체를 바꿉니다. 한 명만 더하거나 빼려면chgrpmem -m + 사용자 그룹,chgrpmem -m - 사용자 그룹이 편합니다.- 사용자를 그 사용자의 주 그룹에서 뺄 수는 없습니다.
- 관리 그룹(admin=true)은 root나 UserAdmin·
aix.security.group.change권한이 있어야 바꿉니다. NIS 데이터베이스가 있는 시스템에서는 쓰지 않습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 EFS 키 저장소 속성, domainlessgroups, 종료 상태·감사 이벤트 절이 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 1, 6.1 Volume 1 |
| 파일 | /usr/bin/chgroup, /etc/group, /etc/security/group |
| 관련 명령어 | mkgroup, lsgroup, rmgroup, chgrpmem, chuser |
목적
그룹 속성을 바꿉니다.
영어 원문
Changes attributes for groups.
구문
chgroup [ -R load_module ] Attribute=Value ... Group
설명
주의: 시스템에 NIS(Network Information Service) 데이터베이스가 설치되어 있으면 chgroup을 쓰지 않습니다. 시스템 데이터베이스가 심각하게 어긋날 수 있습니다.
chgroup 명령은 Group 매개변수로 지정한 그룹의 속성을 바꿉니다. 그룹 이름이 이미 있어야 합니다. 속성을 바꾸려면 Attribute=Value로 속성 이름과 새 값을 줍니다.
다른 식별·인증(I&A) 메커니즘으로 만든 그룹은 -R로 그 I&A 로드 모듈을 지정합니다. 로드 모듈은 /usr/lib/security/methods.cfg에 정의됩니다.
Web-based System Manager(wsm)의 Users 응용 프로그램이나 SMIT 빠른 경로 smit chgroup으로도 실행할 수 있습니다.
그룹 ID를 바꾸면 시스템 보안을 해칠 수 있으므로 바꾸지 않는 것이 좋습니다. 그래도 바꿀 때는 dist_uniqid 속성이 ID 충돌 검사를 제어하며, 동작은 mkgroup과 같습니다.
그룹 변경 제한
그룹 정보를 지키려고 다음은 root나 UserAdmin 또는 aix.security.group.change 권한이 있는 사용자만 할 수 있습니다.
admin속성을true로 해서 관리 그룹으로 만들기- 관리 그룹의 속성 바꾸기
- 관리 그룹의 관리자 목록에 사용자 더하기
관리 그룹은 admin 속성이 true인 그룹입니다. security 그룹 구성원은 관리 그룹이 아닌 그룹의 속성을 바꾸고 관리자 목록에 사용자를 더할 수 있습니다.
영어 원문
Attention: Do not use the chgroup command if you have a Network Information Service (NIS) database installed on your system, as this could cause serious system database inconsistencies.
The chgroup command changes attributes for the group specified by the Group parameter. The group name must already exist. To change an attribute, specify the attribute name and the value you want to change it to in the Attribute=Value parameter.
To change the attributes for a group that was created with an alternate Identification and Authentication (I&A) mechanism, the -R flag can be used to specify the I&A loadable module. Load modules are defined in the /usr/lib/security/methods.cfg file.
You can use the Users application in Web-based System Manager (wsm) to change user characteristics. You could also use the System Management Interface Tool (SMIT) smit chgroup fast path to run this command.
Changing the ID for an account can compromise system security and as a result one should not do so. However, when the ID is changed using the chgroup command, ID collision checking is also controlled by the dist_uniqid attribute in the usw stanza of the /etc/secvars.cfg file. The behavior of ID collision control is the same as that described for the mkgroup command.
Restrictions on Changing Groups
To ensure the security of group information, there are restrictions on using the chgroup command. Only the root user or users with UserAdmin or aix.security.group.change authorization can use the chgroup command to change any group. These changes include:
Make a group an administrative group by setting the admin attribute to true.
Change any attributes of an administrative group.
Add users to an administrative group's administrators list.
An administrative group is a group with the admin attribute set to true. Members of the security group can change the attributes of nonadministrative groups including adding users to the list of administrators.
Flag
| 플래그 | 설명 |
|---|---|
-R load_module |
그룹 속성을 바꿀 때 쓸 로드 가능한 I&A 모듈. |
속성
적절한 권한이 있으면 다음 그룹 속성을 Attribute=Value로 정할 수 있습니다.
| 속성 | 설명 |
|---|---|
adms |
그룹의 구성원과 관리자를 정하는 것 같은 관리 작업을 할 수 있는 사용자(로그인 이름을 쉼표로 나눔). 값을 주지 않으면 관리자를 모두 지웁니다. admin=true면 root만 바꿀 수 있어 무시합니다. |
admin |
관리 그룹 여부. true면 관리 그룹으로 root만 속성을 바꿀 수 있고, false(기본)면 root나 security 그룹 구성원이 바꿀 수 있습니다. |
id |
그룹 ID(고유 정수). 바꾸면 보안을 해치므로 바꾸지 않는 것이 좋습니다. |
projects |
프로세스를 할당할 수 있는 프로젝트(쉼표로 나눔, 왼쪽부터). 올바르지 않은 이름은 오류. |
users |
구성원 목록(User1,User2,...). 모든 사용자가 데이터베이스에 정의되어 있어야 합니다. 사용자를 그 주 그룹에서 뺄 수는 없습니다. (6.1) domainlessgroups가 정해져 있으면 LDAP 사용자를 로컬 그룹에(또는 반대로) 넣을 수 있습니다. |
efs_initialks_mode |
(6.1, EFS) 그룹 키 저장소의 처음 모드. admin(기본, root 등이 관리 키로 열 수 있음), guard(열 수 없음). mkgroup과 함께 쓰며, 만든 뒤 바꿔도 모드는 바뀌지 않으므로 efskeymgr를 씁니다. |
efs_keystore_algo |
(6.1, EFS) 키 저장소를 만들 때 그룹 개인 키 생성 알고리즘. RSA_1024(기본), RSA_2048, RSA_4096. 만든 뒤 바꿔도 키는 다시 만들어지지 않으므로 efskeymgr를 씁니다. |
efs_keystore_access |
(6.1, EFS) 그룹 키 저장소의 데이터베이스 유형. file(기본, /var/efs/groups/그룹/keystore를 만듦), none(만들지 않음). |
adms와 admin은 /etc/security/group에, 나머지는 /etc/group에 둡니다. 준 속성 가운데 하나라도 올바르지 않으면 아무것도 바꾸지 않습니다.
영어 원문
-R— Specifies the loadable I&A module used to change user's attributes.- Attributes
You change attributes by specifying an Attribute=Value parameter. If you have the proper authority you can set the following group attributes:
- adms — Defines the users who can perform administrative tasks for the group, such as setting the members and administrators of the group. This attribute is ignored if admin = true, since only the root user can alter a group defined as administrative. The Value parameter is a list of comma-separated user login names. If you do not specify a Value parameter, all the administrators are removed.
- admin — Defines the administrative status of the group. You can specify the following values: true Defines the group as administrative. Only the root user can change the attributes of groups defined as administrative. false Defines a standard group. The attributes of these groups can be changed by the root user or a member of the security group. This is the default value.
- id — The group ID. The Value parameter is a unique integer string. Changing this attribute compromises system security and, for this reason, you should not change this attribute.
- projects — Defines the list of projects to which the user's processes can be assigned. The value is a list of comma-separated project names and is evaluated from left to right. The project name should be a valid project name as defined in the system. If an invalid project name is found on the list, it will be reported as an error.
- users — Specifies a list of one or more users in the form: User1, User2,..., Usern. The group member names are separated by commas. Each user must be defined in the database configuration files. You cannot remove users from their primary group. If the domainlessgroups attribute is set in the secvars.cfg file, users from the Lightweight Directory Access Protocol (LDAP) group can be assigned to the local group and vice versa.
efs_initialks_mode— Specifies the initial mode of the group keystore. You can specify the following values: admin Root or other security privileged system users can open the group keystore using the admin key. guard Root users cannot open the group keystore using the admin key. The default value is admin. The attribute specifies the initial mode of the group keystore. You can use the attribute with the mkgroup command. After the keystore has been created, changing the attribute value with the chuser, chgroup, or chsec command, or manual editing does not change the mode of the keystore unless the keystore is deleted and a new one is created. To change the keystore mode, use the efskeymgr command. Restriction: The attribute is valid only when the system is EFS-enabled.efs_keystore_algo— Specifies the algorithm that is used to generate the private key of the group during the keystore creation. You can specify the following values: •RSA_1024•RSA_2048•RSA_4096The default value isRSA_1024. You can use the attribute with the mkgroup command. After the keystore has been created, changing the value of this attribute with the chuser, chgroup, or chsec command, or manual editing does not regenerate the private key unless the keystore is deleted and a new one is created. To change the algorithm for the keys, use the efskeymgr command. Restriction: The attribute is valid only when the system is EFS-enabled.efs_keystore_access— Specifies the database type of the group keystore. You can specify the following values: file Creates the /var/efs/groups/grpname/keystore keystore file associated with the group. none The keystore is not created. All other keystore attributes have no effect. The default value is file. Restriction: The attribute is valid only when the system is EFS-enabled.
The adms and admin attributes are set in the /etc/security/group file. The remaining attributes are set in the /etc/group file. If any of the attributes you specify with the chgroup command are invalid, the command makes no changes at all.
종료 상태
| 값 | 뜻 |
|---|---|
| 0 | 성공했고 요청한 변경을 모두 함 |
| 0보다 큼 | 오류. 출력된 오류 메시지에 실패 내용이 자세히 나옴 |
영어 원문
This command returns the following exit values:
- 0 — The command runs successfully and all requested changes are made.
>0— An error occurred. The printed error message gives further details about the type of failure.
보안
접근 제어: 이 명령의 실행(x) 권한은 root와 security 그룹에만 줘야 합니다. 신뢰 컴퓨팅 기반(TCB) 프로그램으로 설치하고, root가 소유하며 setuid(SUID) 비트를 켜 둬야 합니다.
감사 이벤트: GROUP_Change(그룹, 속성).
읽고 쓰는 파일: /etc/group, /etc/security/group(읽기·쓰기), /etc/passwd(읽기).
RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1 문서에만 있음).
영어 원문
Access Control
This command should grant execute (x) access only to the root user and the security group. This command should be installed as a program in the trusted computing base (TCB). The command should be owned by the root user with the setuid (SUID) bit set.
Auditing Events
Event Information GROUP_Change group, attributes
Files Accessed
Mode File rw /etc/group rw /etc/security/group r /etc/passwd
Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.
Limitations
모든 로드 가능한 I&A 모듈이 그룹 속성 변경을 지원하지는 않습니다. 지원하지 않으면 오류를 보고합니다.
영어 원문
Changing a group's attributes may not be supported by all loadable I&A modules. If the loadable I&A module does not support changing a group's attributes, an error is reported.
예제
| 명령 | 하는 일 |
|---|---|
chgroup users=sam,carol,frank finance |
지금 frank만 있는 finance 그룹에 sam과 carol을 더함 |
chgroup users=sam,carol adms= finance |
finance에서 frank를 빼고 sam, carol은 남기며 관리자를 모두 지움(adms 값을 비움) |
chgroup -R LDAP users=sam,frank monsters |
LDAP I&A 모듈 그룹 monsters의 구성원을 바꿈 |
자주 쓰는 형태:
lsgroup -a users appgrp # 지금 구성원
chgrpmem -m + app3 appgrp # 한 명 더하기(목록을 다시 쓰지 않아도 됨)
chgrpmem -m - app1 appgrp # 한 명 빼기
chgroup adms=app1 appgrp # 그룹 관리자 지정
영어 원문
- To add
samandcarol to thefinancegroup, which currently only hasfrankas a member, type:
chgroup users=sam,carol,frank finance
- To remove
frankfrom thefinancegroup, but retainsamandcarol, and to remove the administrators of thefinancegroup, type:chgroup users=sam,carol adms= finance
In this example, two attribute values were changed. The name frank was omitted from the list of members, and the value for the adms attribute was left blank.
- To change the LDAP I&A loadable module group user's attribute, type:
chgroup -R LDAP users=sam,frank monsters
파일
| 파일 | 설명 |
|---|---|
/usr/bin/chgroup |
chgroup 명령 |
/etc/group |
그룹의 기본 속성 |
/etc/security/group |
그룹의 확장 속성 |
/etc/passwd |
사용자의 기본 속성 |
영어 원문
- /usr/bin/chgroup — Specifies the path to the chgroup command.
- /etc/group — Contains the basic attributes of groups.
- /etc/security/group — Contains the extended attributes of groups.
- /etc/passwd — Contains the basic attributes of users.
Related reference:
- chgrpmem Command
- chsh Command
Related information:
- rmuser command
- setgroups command
- setsenv command
리눅스(GNU)와 다른 점
리눅스에서는 useradd·usermod·userdel(또는 Debian 계열의 adduser), groupadd·groupmod·groupdel, passwd, chage(비밀번호 만료), id·getent passwd 이름(조회)을 씁니다. AIX의 /etc/security/user처럼 사용자별 보안 속성을 한 파일에 두지 않고, 비밀번호 정책은 /etc/login.defs와 PAM(pam_pwquality, pam_faillock), 자원 한도는 /etc/security/limits.conf에 둡니다. chgroup에 해당하는 것은 groupmod(-g GID, -n 이름)와 gpasswd(-M 목록 구성원 전체 지정, -a·-d 한 명 더하기·빼기, -A 관리자)입니다.