mkuser 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-mkuser
핵심 정리
- 새 사용자 계정을 만듭니다.
mkuser 이름또는mkuser 속성=값 ... 이름. 예:mkuser id=2001 pgrp=staff groups=staff,app home=/home/app1 shell=/usr/bin/ksh app1. - 지정하지 않은 속성은
/usr/lib/security/mkuser.default(user·admin 스탠자)의 값을 씁니다. 홈 디렉터리 생성 등은/usr/lib/security/mkuser.sys가 합니다. - 비밀번호는 만들지 않습니다(
*로 둠).passwd 이름이나pwdadm 이름으로 정할 때까지 계정은 쓸 수 없습니다. -a는 관리 사용자(admin=true)로 만들며 root만 할 수 있습니다.-R LDAP처럼 다른 I&A 모듈에 만들 수 있습니다.- 사용자 이름은
-,+,@,~로 시작할 수 없고: " # , = \ / ? ' 백쿼트, 공백·탭을 쓸 수 없습니다. 이름 길이 한도는chdev -l sys0 -a max_logname=으로 정합니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (내용이 같고, 6.1 문서에 RBAC 권한 안내가 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 3, 6.1 Volume 3 |
| 파일 | /usr/bin/mkuser, /usr/lib/security/mkuser.default, /usr/lib/security/mkuser.sys, /etc/security/user |
| 관련 명령어 | chuser, lsuser, rmuser, passwd, pwdadm, mkgroup, chsec |
목적
새 사용자 계정을 만듭니다.
영어 원문
Creates a new user account.
구문
mkuser [ -R load_module ] [ -a ] [ Attribute=Value ... ] Name
설명
mkuser 명령은 새 사용자 계정을 만듭니다. Name 매개변수는 고유한 문자열이어야 하며, 길이는 관리자가 chdev로 정합니다. 사용자 이름에 ALL이나 default 키워드는 쓸 수 없습니다. 기본으로 일반 사용자 계정을 만들고, 관리 사용자 계정을 만들려면 -a를 줍니다.
다른 식별·인증(I&A) 메커니즘으로 사용자를 만들려면 -R로 I&A 로드 모듈을 지정합니다. -R 없이 만들면 로컬에 만듭니다. 로드 모듈은 /usr/lib/security/methods.cfg에 정의됩니다.
mkuser는 비밀번호 정보를 만들지 않고 비밀번호 필드를 *로 초기화합니다. 나중에 passwd나 pwdadm으로 정하며, 그렇게 /etc/security/passwd에 인증 정보를 넣을 때까지 새 계정은 쓸 수 없습니다.
Web-based System Manager의 Users 응용 프로그램이나 SMIT 빠른 경로 smit mkuser로도 실행할 수 있습니다.
mkuser는 늘 대상 사용자 레지스트리에서 새 계정의 ID가 고유한지 검사합니다. 시스템 속성 dist_uniqid로 시스템의 모든 사용자 레지스트리를 검사하게 할 수도 있습니다. 이 속성은 /etc/security/login.cfg의 usw 스탠자에 있으며 chsec으로 관리합니다.
dist_uniqid 값 |
뜻 |
|---|---|
never |
대상이 아닌 레지스트리와의 ID 충돌은 검사하지 않음(기본) |
always |
다른 모든 레지스트리와의 ID 충돌을 검사. 대상과 다른 레지스트리 사이에 충돌이 있으면 계정 생성·변경이 실패 |
uniqbyname |
다른 모든 레지스트리와의 ID 충돌을 검사하되, 만들 계정의 이름이 기존 계정과 같으면 충돌을 허락 |
참고: 대상 레지스트리 안의 ID 충돌 검사는 dist_uniqid와 상관없이 늘 합니다.
uniqbyname은 레지스트리가 둘일 때 잘 동작합니다. 셋 이상이고 두 레지스트리 사이에 이미 ID 충돌이 있으면, 그 ID로 세 번째 레지스트리에 계정을 만들 때의 동작은 정해져 있지 않으며 레지스트리를 검사하는 순서에 따라 성공하거나 실패할 수 있습니다.
ID 충돌 검사는 로컬과 원격 레지스트리, 또는 원격 레지스트리끼리의 고유성만 보장합니다. 원격 레지스트리에 새로 만든 계정과, 같은 원격 레지스트리를 쓰는 다른 시스템의 로컬 사용자 사이의 고유성은 보장하지 않습니다. 명령을 실행할 때 닿을 수 없는 원격 레지스트리는 건너뜁니다.
영어 원문
The mkuser command creates a new user account. The Name parameter must be a unique string (whose length is administrator-configurable using the chdev command) . You cannot use the ALL or default keywords in the user name. By default, the mkuser command creates a standard user account. To create an administrative user account, specify the -a flag.
To create a user with an alternate Identification and Authentication (I&A) mechanism, you can use the -R flag to specify the I&A load module. If you create users without the -R flag, you create the users locally. Load modules are defined in the /usr/lib/security/methods.cfg file.
The mkuser command does not create password information for a user. It initializes the password field with an * (asterisk). Later, this field is set with the passwd or pwdadm command. New accounts are disabled until the passwd or pwdadm commands are used to add authentication information to the /etc/security/passwd file.
You can use the Users application in Web-based System Manager to change user characteristics. You can also use the System Management Interface Tool (SMIT) smit mkuser fast path to run this command.
The mkuser command always checks the target user registry to make sure the ID for the new account is unique to the target registry. You can also configure the mkuser command to check all user registries of the system using the dist_uniqid system attribute. The dist_uniqid system attribute is an attribute of the usw stanza of the /etc/security/login.cfg file, and can be managed using the chsec command.
The dist_uniqid system attribute has the following values:
never - Does not check for ID collision against the non-target registries. This is the default setting.
always - Checks for ID collision against all other registries. If collision is detected between the target registry and any other registry account creation or modification fails.
uniqbyname - Checks for ID collision against all other registries. Collision between registries is allowed only if the account to be created has the same name as the existing account.
Note: ID collision detection in the target registry is always enforced regardless of the dist_uniqid system attribute.
The uniqbyname system attribute setting works well against two registries. With more than two registries, and with ID collision already existing between two registries, the behavior of the mkuser command is unspecified when creating a new account in a third registry using colliding ID values. The new account creation might succeed or fail depending the order in which the registries are checked.
The check for ID collision only enforces ID uniqueness between the local registry and remote registries or between remote registries. There is no guarantee of ID uniqueness between the newly created account on the remote registry and existing local users on other systems that make use of the same remote registry. The mkuser command bypasses a remote registry if the remote registry is not reachable at the time the command is run.
Restrictions on Creating User Names
로그인이 꼬이지 않도록 대문자로만 된 사용자 이름은 피합니다. mkuser는 멀티바이트 사용자 이름을 지원하지만, POSIX 이식 가능 파일 이름 문자 집합만 쓰기를 권합니다.
사용자 데이터베이스가 망가지지 않도록 사용자 이름은 -(대시), +(더하기), @(골뱅이), ~(물결)로 시작하면 안 됩니다. ALL과 default 키워드도 쓸 수 없습니다. 또 다음 문자를 이름에 쓰지 않습니다.
| 문자 | 이름 | 문자 | 이름 |
|---|---|---|---|
: |
콜론 | " |
큰따옴표 |
# |
샵 | , |
쉼표 |
= |
등호 | \ |
백슬래시 |
/ |
슬래시 | ? |
물음표 |
' |
작은따옴표 | 백쿼트 | 역따옴표 |
Name에는 공백, 탭, 줄바꿈 문자도 쓸 수 없습니다.
영어 원문
To prevent login inconsistencies, you should avoid composing user names entirely of uppercase alphabetic characters. While the mkuser command supports multi-byte user names, it is recommended that you restrict user names to characters with the POSIX portable filename character set.
To ensure that your user database remains uncorrupted, you must be careful when naming users. User names must not begin with a - (dash), + (plus sign), @ (at sign), or ~ (tilde). You cannot use the keywords ALL or default in a user name. Additionally, do not use any of the following characters within a user-name string:
- : — Colon
- " — Double quote
#— Pound sign- , — Comma
- = — Equal sign
\— Back slash- / — Slash
- ? — Question mark
- ' — Single quote
- ' — Back quote
Finally, the Name parameter cannot contain any space, tab, or new-line characters.
플래그
| 플래그 | 설명 |
|---|---|
-a |
관리 사용자로 만듭니다. root만 이 플래그를 쓰거나 관리 사용자의 속성을 바꿀 수 있습니다. |
-R load_module |
사용자를 만들 때 쓸 로드 가능한 I&A 모듈. |
영어 원문
-a— Specifies that the user is an administrator. Only the root user can use this flag or alter the attributes of an administrative user.- username — Specifies that the user is a new user.
-Rload_module— Specifies the loadable I&A module used to create the user.
매개변수
| 매개변수 | 설명 |
|---|---|
Attribute=Value |
사용자 속성을 초기화합니다. 쓸 수 있는 속성과 값은 chuser를 봅니다. |
| Name | 고유한 문자열. 길이는 관리자가 chdev로 정합니다. |
영어 원문
- Attribute=Value — Initializes a user attribute. Refer to the chuser command for the valid attributes and values.
- Name — Specifies a unique string. The length of this string is set by an administrator by using the chdev command.
종료 상태
| 값 | 뜻 |
|---|---|
| 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 lists further details about the type of failure.
보안
접근 제어: 이 명령의 실행(x) 권한은 root와 security 그룹 구성원에게만 줘야 합니다. 신뢰 컴퓨팅 기반(TCB) 프로그램으로 설치하고, root가 소유하며 setuid(SUID) 비트를 켜 둬야 합니다.
RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1 문서에만 있음). 명령의 기능을 모두 쓰려면 역할에 accessauths 말고도 aix.security.user.audit, aix.security.role.assign, aix.security.group.change, aix.security.user.change 권한이 있어야 합니다.
읽고 쓰는 파일: /etc/passwd, /etc/security/user, /etc/security/user.roles, /etc/security/limits, /etc/security/environ, /etc/group, /etc/security/group(읽기·쓰기), /usr/lib/security/mkuser.default(읽기), /usr/lib/security/mkuser.sys(실행).
감사 이벤트: USER_Create(사용자).
영어 원문
Access Control: This command should grant execute (x) access only to the root user and members of 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.
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. To get the full functionality of the command, besides the accessauths, the role should also have the following authorizations:
aix.security.user.audit
aix.security.role.assign
aix.security.group.change
aix.security.user.change
Files Accessed:
Mode File rw /etc/passwd rw /etc/security/user rw /etc/security/user.roles rw /etc/security/limits rw /etc/security/environ rw /etc/group rw /etc/security/group r /usr/lib/security/mkuser.default x /usr/lib/security/mkuser.sys
Auditing Events:
Event Information USER_Create user
Limitations
모든 로드 가능한 I&A 모듈이 사용자 생성을 지원하지는 않습니다. 지원하지 않으면 오류를 보고합니다.
영어 원문
Creating a user may not be supported by all loadable I&A modules. If the loadable I&A module does not support creating a user, an error is reported.
예제
| 명령 | 하는 일 |
|---|---|
mkuser davis |
/usr/lib/security/mkuser.default의 기본값으로 davis 계정을 만듦 |
mkuser -a davis |
davis를 관리 사용자로 만듦. root나 UserAdmin 권한이 있는 사용자만 할 수 있음 |
mkuser su=false davis |
davis를 만들고 su 속성을 false로 |
mkuser -R LDAP davis |
LDAP 로드 모듈로 식별·인증되는 davis 계정을 만듦 |
자주 쓰는 형태:
mkuser id=2001 pgrp=staff groups=staff,app home=/home/app1 shell=/usr/bin/ksh gecos="App user" app1
echo "app1:Temp1234!" | chpasswd # 비밀번호 지정(처음 로그인 때 바꾸게 함)
pwdadm -f ADMCHG app1 # 다음 로그인 때 비밀번호 바꾸게
lsuser -f app1
cat /usr/lib/security/mkuser.default # 기본값
영어 원문
- To create the
davisuser account with the default values in the /usr/lib/security/mkuser.default file, type:
mkuser davis
- To create the
davisaccount withdavisas an administrator, type:
mkuser -a davis
Only the root user or users with the UserAdmin authorization can create davis as an administrative user.
- To create the
davisuser account and set the su attribute to a value offalse, type:
mkuser su=false davis
- To create the
davisuser account that is identified and authenticated through the LDAP load module, type:
mkuser -R LDAP davis
Error Codes
| 코드 | 뜻 |
|---|---|
| 0 | 성공 |
EINVAL |
사용자 이름 인수가 올바르지 않음(쓸 수 없는 문자 포함) |
EACCES |
실행한 사용자에게 데이터베이스 파일 쓰기 권한이 없음 |
EPERM |
-a를 줬는데 실행한 사용자가 root가 아님 |
EEXIST |
사용자가 이미 있음 |
ENAMETOOLONG |
사용자 이름이 너무 김 |
| 그 밖의 errno | 다른 시스템 오류 |
영어 원문
- 0 — The command is successful.
- EINVAL — The username argument is not valid (containing characters not valid).
- EACCES — The invoker does not have write access to the database files.
- EPERM — The user identification and authentication fails if the
-aflag is specified and the invoker is not root. - EEXIST — The user already exists.
- ENAMETOOLONG — The user name is too long.
- other errno — There are other system errors.
파일
| 파일 | 설명 |
|---|---|
/usr/bin/mkuser |
mkuser 명령 |
/usr/lib/security/mkuser.default |
새 사용자의 기본값 |
/etc/passwd |
사용자의 기본 속성 |
/etc/security/user |
사용자의 확장 속성 |
/etc/security/user.roles |
사용자의 관리 역할 속성 |
/etc/security/passwd |
비밀번호 정보 |
/etc/security/limits |
사용자별 자원 한도 |
/etc/security/environ |
사용자의 환경 속성 |
/etc/group |
그룹의 기본 속성 |
/etc/security/group |
그룹의 확장 속성 |
/etc/security/.ids |
일반·관리 사용자 ID와 그룹 ID |
영어 원문
- /usr/bin/mkuser — Contains the mkuser command.
- /usr/lib/security/mkuser.default — Contains the default values for new users.
- /etc/passwd — Contains the basic attributes of users.
- /etc/security/user — Contains the extended attributes of users.
- /etc/security/user.roles — Contains the administrative role attributes of users.
- /etc/security/passwd — Contains password information.
- /etc/security/limits — Defines resource quotas and limits for each user.
- /etc/security/environ — Contains the environment attributes of users.
- /etc/group — Contains the basic attributes of groups.
- /etc/security/group — Contains the extended attributes of groups.
- /etc/security/.ids — Contains standard and administrative user IDs and group IDs.
Related reference:
- lsgroup Command
- mkuser.sys Command
Related information:
pwdadm command setgroups command PowerHA SystemMirror Administration Guide
리눅스(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에 둡니다. mkuser에 해당하는 것은 useradd -u 2001 -g staff -G app -m -d /home/app1 -s /bin/bash app1이며, 기본값은 /etc/default/useradd와 /etc/login.defs에 있습니다.