lsuser 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-lsuser
핵심 정리
- 사용자 계정 속성을 보여 줍니다.
lsuser 이름(한 사용자),lsuser ALL(모든 사용자). 이름이 기본값이 아니라 ALL을 꼭 줘야 합니다. -a 속성...으로 원하는 속성만 봅니다. 예:lsuser -a id pgrp groups home shell 이름,lsuser -a account_locked unsuccessful_login_count 이름.- 출력 형식: 기본(한 줄에
속성=값),-f(스탠자),-c(콜론),-C(6.1, 파싱하기 쉬운 콜론). - 일반 사용자도 실행할 수 있지만, 실행한 사용자의 권한으로 읽으므로 볼 수 없는 속성이 있습니다.
- 속성의 뜻과 값은
chuser문서에 있습니다. 기본값은/etc/security/user의default스탠자에서 옵니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 -C(파싱하기 쉬운 콜론 형식)와 domainlessgroups 안내가 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 3, 6.1 Volume 3 |
| 파일 | /usr/sbin/lsuser, /etc/passwd, /etc/security/user, /etc/security/limits |
| 관련 명령어 | mkuser, chuser, rmuser, lsgroup, id, passwd, pwdadm |
목적
사용자 계정 속성을 보여 줍니다.
영어 원문
Displays user account attributes.
구문
lsuser [ -R load_module ] [ -c | -C | -f ] [ -a List ] { ALL | Name [ ,Name ] ... }
-C는 6.1 구문에만 있습니다.
설명
lsuser 명령은 사용자 계정 속성을 보여 줍니다. 모든 시스템 사용자의 모든 속성이나 특정 사용자의 모든 속성을 볼 수 있습니다. 기본 매개변수가 없으므로 모든 사용자를 보려면 ALL 키워드를 줘야 합니다. 기본으로 모든 속성을 보여 주며, 일부만 보려면 -a List를 씁니다. 읽을 수 없는 속성이 있으면 되도록 많은 정보를 보여 주고, 빈 속성은 보여 주지 않습니다.
(6.1) 참고: /etc/secvars.cfg에 domainlessgroups 속성이 정해져 있으면 LDAP 모듈과 LOCAL 모듈의 그룹을 합쳐 보여 줍니다.
기본으로 사용자마다 한 줄에, 공백으로 나눈 Attribute=Value 형식으로 보여 줍니다. 스탠자 형식은 -f, 콜론으로 나눈 레코드는 -c나 -C를 씁니다.
Web-based System Manager(wsm)의 Users 응용 프로그램이나 SMIT 빠른 경로 smit lsusers로도 실행할 수 있습니다.
영어 원문
The lsuser command displays the user account attributes. You can use this command to list all attributes of all the system users or all the attributes of specific users. Since there is no default parameter, you must enter the ALL keyword to see the attributes of all the users. By default, the lsuser command displays all user attributes. To view selected attributes, use the -a List flag. If one or more attributes cannot be read, the lsuser command lists as much information as possible, but does not display empty attributes.
Note: If the domainlessgroups attribute is set in the /etc/secvars.cfg file, the lsuser command lists the merged group from the LDAP module and the LOCAL module, if present.
By default, the lsuser command lists each user's attributes on one line. It displays attribute information as Attribute=Value definitions, each separated by a blank space. To list the user attributes in stanza format, use the -f flag. To list the information as colon-separated records, use the -c or -C flag.
You can use the Users application in Web-based System Manager (wsm) to change user characteristics. You can also use the System Management Interface Tool (SMIT) smit lsusers fast path to run this command.
플래그
| 플래그 | 설명 |
|---|---|
-a List |
보여 줄 속성. chuser에 정의된 속성을 공백으로 나눠 줍니다. 빈 목록이면 사용자 이름만 보여 줍니다. |
-c |
콜론으로 나눈 레코드로 보여 줍니다. 형식: # name: attribute1: attribute2: ... 다음 줄에 User: value1: value2: ... |
-C |
-c보다 파싱하기 쉬운 콜론 레코드로 보여 줍니다. 첫 줄 #name:attribute1:attribute2:...는 각 필드가 무슨 속성인지 알려 주는 주석입니다. -a를 주면 속성 순서가 -a의 순서와 같고, 값이 없는 속성도 빈 필드로 나오며, 마지막 필드는 콜론 없이 줄바꿈으로 끝납니다. 6.1부터 |
-f |
사용자 이름으로 구분한 스탠자 형식으로, Attribute=Value를 한 줄에 하나씩 보여 줍니다. |
-R load_module |
사용자 계정 속성을 볼 때 쓸 로드 가능한 I&A(식별·인증) 모듈. (6.1) domainlessgroups가 정해져 있고 -R LDAP을 주면, 사용자가 LOCAL에만 있고 LDAP에 없을 때는 LOCAL 모듈에서 속성을 가져옵니다. -R files도 같습니다. |
영어 원문
-aList — Lists the attributes to display. The List variable can include any attribute that is defined in the chuser command and requires a blank space between attributes. If you specify an empty list, only the user names are displayed.-c— Displays the user attributes in colon-separated records, as follows:# name: attribute1: attribute2: ... User: value1: value2: ...-C— Displays the user attributes in colon-separated records that are easier to parse than the output of the-cflag:#name:attribute1:attribute2: ... User1:value1:value2: ... User2:value1:value2: ...The output is preceded by a comment line that has details about the attribute represented in each colon-separated field. If you also specify the-aflag, the order of the attributes matches the order specified in the-aflag. If you do not have a value for a given attribute, the field is still displayed, but is empty. The last field in each entry ends with a newline character rather than a colon.-f— Displays the output in stanzas, with each stanza identified by a user name. Each Attribute=Value pair is listed on a separate line:user: attribute1=value attribute2=value attribute3=value-Rload_module— Specifies the loadable I&A module that is used to display the user account attributes. If the domainlessgroups attribute is set in the /etc/secvars.cfg file and the-RLDAP command is used, the attribute list is obtained from the LOCAL module. This condition applies if the user exists on the LOCAL module, and does not exist on the LDAP module. This condition also applies to the-Rfiles 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 to the type of failure.
보안
접근 제어: 모든 사용자에게 실행(x) 권한이 있는 일반 사용자 프로그램이어야 합니다. 속성은 명령을 실행한 사용자의 접근 권한으로 읽으므로, 모든 정보를 볼 수 없는 사용자도 있습니다. 이 명령에는 신뢰 컴퓨팅 기반(TCB) 속성이 있어야 합니다.
RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1 문서에만 있음). 명령의 기능을 모두 쓰려면 역할에 accessauths 말고도 aix.security.user.audit 권한이 있어야 합니다.
Trusted AIX 시스템에서는 aix.mls.clear.read 권한이 있는 사용자만 다른 사용자의 허가 등급(clearance) 속성을 볼 수 있습니다.
읽는 파일: /etc/passwd, /etc/security/user, /etc/security/user.roles, /etc/security/limits, /etc/security/environ, /etc/group, /etc/security/audit/config, /etc/security/enc/LabelEncodings.
영어 원문
Access Control: This command must be a general user program with execute (x) access for all users. Since the attributes are read with the access rights of the user who starts the command, some users might not be able to access all the information. This command must have the trusted computing base attribute.
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 must also have the aix.security.user.audit authorization.
On a Trusted AIX system, only users with authorization aix.mls.clear.read can list clearance attributes of other users. See Trusted AIX in the Security for more information.
Files Accessed:
Mode File r /etc/passwd r /etc/security/user r /etc/security/user.roles r /etc/security/limits r /etc/security/environ r /etc/group r /etc/security/audit/config r /etc/security/enc/LabelEncodings
예제
smith계정의 ID와 그룹 정보를 스탠자 형식으로 봅니다.
lsuser -f -a id pgrp groups admgroups smith
smith:
id=2457
pgrp=system
groups=system,finance,staff,accounting
admgroups=finance,accounting
smith의 ID, 홈 디렉터리, 그룹을 콜론 형식으로 봅니다.
lsuser -c -a id home groups smith
#name:id:home:groups
smith:2457:/home/smith:system,finance,staff,accounting
- 그 밖의 예:
| 명령 | 하는 일 |
|---|---|
lsuser smith |
smith의 모든 속성을 기본 형식(공백으로 나눔)으로 |
lsuser ALL |
모든 사용자의 모든 속성 |
자주 쓰는 형태:
lsuser -a account_locked unsuccessful_login_count login rlogin smith # 로그인이 안 될 때
lsuser -f -a maxage minlen histsize expires smith # 비밀번호 정책
lsuser -C -a id pgrp home shell ALL > /tmp/users.csv # (6.1) 목록 내보내기
lsuser -a time_last_login smith # 마지막 로그인(초)
영어 원문
- To display the user
idand group-related information about thesmithaccount in stanza form, enter the following command:
lsuser -f -a id pgrp groups admgroups smith
Information similar to the following is displayed:
smith:
ID=2457
pgrp=system
groups=system,finance,staff,accounting
admgroups=finance,accounting
- To display the user
id,groups, and home directory ofsmithin colon format, enter the following command:
lsuser -c -a id home groups smith
Information similar to the following is displayed:
# name: ID:home:groups
smith: 2457:/home/smith:system,finance,staff,accounting
- To display all the attributes of user
smithin the default format, enter the following command:
lsuser smith
All the attribute information is displayed, with each attribute separated by a blank space.
- To display all the attributes of all the users, enter the following command:
lsuser ALL
All the attribute information is displayed, with each attribute separated by a blank space.
파일
| 파일 | 설명 |
|---|---|
/usr/sbin/lsuser |
lsuser 명령 |
/etc/passwd |
기본 사용자 정보 |
/etc/security/limits |
사용자별 자원 한도 |
/etc/security/user |
사용자의 확장 속성 |
/etc/security/user.roles |
사용자의 관리 역할 속성 |
/etc/security/environ |
사용자의 환경 속성 |
/etc/group |
기본 그룹 속성 |
/etc/security/audit/config |
감사 구성 |
/etc/security/enc/LabelEncodings |
Trusted AIX의 레이블 정의 |
영어 원문
- /usr/sbin/lsuser — Contains the lsuser command.
- /etc/passwd — Contains basic user information.
- /etc/security/limits — Defines resource quotas and limits for each user.
- /etc/security/user — Contains the extended attributes of users.
- /etc/security/user.roles — Contains the administrative role attributes of users.
- /etc/security/environ — Contains the environment attributes of users.
- /etc/group — Contains basic group attributes.
- /etc/security/audit/config — Contains the audit configuration files.
- /etc/security/enc/LabelEncodings — Contains label definitions for the Trusted AIX system.
Related reference:
- mkgroup Command
Related information:
- chsh command
- passwd command
- setgroups 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에 둡니다. 사용자 정보는 id 이름, getent passwd 이름, chage -l 이름(비밀번호 만료), faillock --user 이름(로그인 실패)으로 봅니다.