passwd 명령어 (AIX 5.3·6.1)

핵심 정리

  • 비밀번호를 정하고 바꿉니다. passwd(자기), passwd 사용자(다른 사용자, root나 security 그룹만). -f는 gecos(이름), -s는 로그인 셸을 바꿉니다.
  • 일반 사용자는 예전 비밀번호를 넣고 새 비밀번호를 두 번 넣습니다. root는 로컬 사용자의 예전 비밀번호를 묻지 않고, 비밀번호 규칙도 적용받지 않습니다.
  • root가 바꾸면 /etc/security/passwd에 ADMCHG 플래그가 붙어, 사용자는 다음 로그인 때 비밀번호를 바꿔야 합니다.
  • 비밀번호 규칙은 /etc/security/user의 minlen, minalpha, minother, maxage, histsize 등입니다. 기본 암호화(crypt)에서는 처음 8자만 쓰고 7비트 문자만 지원합니다.
  • 여러 사용자의 비밀번호를 스크립트로 정할 때는 chpasswd, 플래그만 다룰 때는 pwdadm을 씁니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (6.1에서 -a(모든 모듈에서 바꾸기), EFS 키 저장소 비밀번호 동기화, 비밀번호 규칙 mindigit 등이 더해짐)
원문 IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4
파일 /usr/bin/passwd, /etc/passwd, /etc/security/passwd, /etc/security/user
관련 명령어 pwdadm, chpasswd, chuser, chsh, chfn, newpass

목적

사용자의 비밀번호를 바꿉니다.

영어 원문

Changes a user's password.

구문

text
passwd [ -R load_module ] [ -f | -s | -a ] [ User ]

-a는 6.1 구문에만 있습니다.

설명

passwd 명령은 사용자의 비밀번호를 정하고 바꿉니다. 자기 비밀번호나 다른 사용자의 비밀번호를 바꿀 수 있습니다. 로그인 이름에 연결된 전체 이름(gecos)과 운영 체제 인터페이스로 쓰는 셸도 바꿀 수 있습니다.

사용자 정의 방식에 따라 비밀번호는 로컬이나 원격에 있습니다. 로컬 비밀번호는 /etc/security/passwd 데이터베이스에, 원격 비밀번호는 원격 도메인의 데이터베이스에 있습니다.

자기 비밀번호를 바꾸려면 passwd를 입력합니다. root가 아니면 예전 비밀번호(있다면)를 묻고, 새 비밀번호를 두 번 묻습니다. 비밀번호는 화면에 보이지 않으며, 두 번 넣은 값이 다르면 다시 묻습니다.

참고: 로컬과 NIS 비밀번호에서 passwd는 처음 8자만 씁니다. 비밀번호에는 7비트 문자만 쓸 수 있어 NLS 코드 포인트는 쓸 수 없습니다.

다른 사용자의 비밀번호를 바꾸려면 passwd와 그 사용자의 로그인 이름을 줍니다. root나 security 그룹 구성원만 할 수 있습니다. 그 사용자의 예전 비밀번호와 새 비밀번호를 묻는데, 로컬 비밀번호면 root에게는 사용자의 예전 비밀번호도 root 비밀번호도 묻지 않습니다. 원격 비밀번호면 기본으로 root에게도 예전 비밀번호를 물어 원격 도메인이 쓸지 무시할지 정하게 하며, 이 동작은 /usr/lib/security/methods.cfg의 rootrequiresopw 옵션으로 바꿉니다. root에게는 비밀번호 규칙을 강제하지 않습니다.

/etc/passwd에는 전체 이름과 쓰는 셸의 경로가 있습니다. 이름을 바꾸려면 passwd -f, 로그인 셸을 바꾸려면 passwd -s를 씁니다.

로컬 비밀번호는 /etc/security/user의 다음 규칙에 맞게 만듭니다.

규칙 뜻
dictionlist 비밀번호를 바꿀 때 검사하는 사전 파일 목록
histexpire 같은 비밀번호를 다시 쓸 수 없는 기간(주)
histsize 다시 쓸 수 없는 예전 비밀번호 수
maxage 비밀번호 최대 사용 기간(주). 지나면 바꿔야 함
maxexpired maxage가 지난 뒤 사용자가 스스로 바꿀 수 있는 기간(주)
maxrepeats 한 문자가 비밀번호에 쓰일 수 있는 최대 횟수
minalpha, minother 영문자, 영문자가 아닌 문자의 최소 수
minlen 최소 길이. 실제로는 minalpha + minother와 minlen 중 큰 값
mindiff 새 비밀번호에 있어야 하는, 예전 비밀번호에 없던 문자 최소 수. 위치는 보지 않아 새 abcd, 예전 edcb면 다른 문자 수는 1
minage 비밀번호를 바꿀 수 있게 되기까지의 최소 기간(주)
minloweralpha, minupperalpha, mindigit, minspecialchar (6.1) 소문자, 대문자, 숫자, 특수 문자의 최소 수
pwdchecks 비밀번호를 바꿀 때 부르는 외부 비밀번호 제한 메서드 목록

root가 /etc/security/passwd의 flags에 NOCHECK을 넣으면 그 사용자의 비밀번호는 이 규칙을 따르지 않아도 됩니다. root는 규칙을 따르지 않고 다른 사용자에게 새 비밀번호를 줄 수 있습니다.

root가 flags에 ADMIN을 넣거나 /etc/passwd의 비밀번호 필드가 *이면 root만 그 비밀번호를 바꿀 수 있습니다. /etc/passwd의 비밀번호 필드가 !이고 /etc/security/passwd의 비밀번호 필드가 *일 때도 root만 바꿀 수 있습니다.

root가 비밀번호를 바꾸면 /etc/security/passwd의 flags에 ADMCHG가 자동으로 붙고, 사용자는 다음 로그인 때 비밀번호를 바꿔야 합니다.

/etc/security/user에서 사용자의 registry 값이 DCE나 NIS면 그 데이터베이스에서만 비밀번호를 바꿀 수 있습니다.

(6.1) 사용자 키 저장소가 없고 efs_keystore_access가 none이 아니면 passwd가 /etc/security/user의 EFS 속성으로 키 저장소를 만듭니다. 예전 비밀번호로 키 저장소를 열 수 있으면 키 저장소 비밀번호도 바꿉니다. 곧 로그인과 키 저장소 비밀번호가 같으면 둘 다 바꿉니다. 원문에는 -a를 주면 비밀번호를 바꾼 뒤 EFS 비밀번호가 로그인 비밀번호와 동기화되지 않아 다음 로그인 때 키 저장소가 자동으로 열리지 않는다고 적혀 있습니다.

영어 원문

The passwd command sets and changes passwords for users. Use this command to change your own password or another user's password. You can also use the passwd command to change the full name (gecos) associated with your login name and the shell you use as an interface to the operating system.

Depending on how the user is defined, the user's password can exist locally or remotely. Local passwords exist in the /etc/security/passwd database. Remote passwords are stored in the database provided by the remote domain.

To change your own password, enter the passwd command. The passwd command prompts the nonroot user for the old password (if one exists) and then prompts for the new password twice. (The password is never displayed on the screen.) If the two entries of the new password do not match, the passwd command prompts for the new password again.

Note: The passwd command uses only the first eight characters of your password for local and NIS passwords. Only 7-bit characters are supported in passwords. For this reason, National Language Support (NLS) code points are not allowed in passwords.

To change another user's password, enter the passwd command and the user's login name (the User parameter). Only the root user or a member of the security group is permitted to change the password for another user. The passwd command prompts you for the old password of the user as well as the new password. For local passwords, the passwd command does not prompt the root user for either the old user password or the root password. For remote passwords, by default the root user will be prompted to input the old password so the remote domain can make the decision to use the password or ignore it. To change this behavior, see the rootrequiresopw option in the /usr/lib/security/methods.cfg file. The passwd command does not enforce any password restrictions upon the root user.

The /etc/passwd file records your full name and the path name of the shell that you use. To change your recorded name, enter the passwd -f command. To change your login shell, enter the passwd -s command.

Construct locally-defined passwords according to the password restrictions in the /etc/security/user configuration file. This file contains the following restrictions:

  • dictionlist — Specifies the list of dictionary files checked when a password is changed.
  • histexpire — Specifies the number of weeks that a user cannot reuse a password.
  • histsize — Specifies the number of previous passwords that the user cannot reuse.
  • maxage — Specifies the maximum age of a password. A password must be changed after a specified amount of time measured in weeks.
  • maxexpired — Specifies the maximum number of weeks beyond the maxage value that a password can be changed by the user.
  • maxrepeats — Specifies the maximum number of times a single character can be used in a password.
  • minalpha — Specifies the minimum number of alphabetic characters.
  • minother — Specifies the minimum number of other characters.
  • minlen — Specifies the minimum number of characters. Note: This value is determined by either the minalpha value plus the minother value or the minlen value, whichever is greater.
  • mindiff — Specifies the minimum number of characters in the new password that are not in the old password. Note: This restriction does not consider position. If the new password is abcd and the old password is edcb, the number of different characters is 1.
  • minage — Specifies the minimum age at which a password can be changed. Passwords must be kept for a minimum period. This value is measured in weeks.
  • minloweralpha — Specifies the minimum number of lowercase alphabetic characters.
  • minupperalpha — Specifies the minimum number of uppercase alphabetic characters.
  • mindigit — Specifies the minimum number of digits.
  • minspecialchar — Specifies the minimum number of special characters.
  • pwdchecks — Specifies the list of external password restriction methods invoked when a password is changed.

If the root user adds the NOCHECK attribute to your flags entry in the /etc/security/passwd file, your password does not need to meet these restrictions. Also, the root user can assign new passwords to other users without following the password restrictions.

If the root user adds the ADMIN attribute to your flags entry or if the password field in the /etc/passwd file contains an * (asterisk), only the root user can change your password. The root user also has the exclusive privilege of changing your password if the password field in /etc/passwd contains an ! (exclamation point) and the password field in the /etc/security/passwd file contains an * (asterisk).

If the root user changes your password, the ADMCHG attribute is automatically added to your flags entry in the /etc/security/passwd file. In this case, you must change the password the next time you log in.

If the user's registry value in the /etc/security/user file is either DCE or NIS, the password change can only occur in the specified database.

The passwd command creates the user keystore, if the keystore does not exist and if the efs_keystore_access attribute value of the user is not none. The keystore is created with the Encrypted File System (EFS) attributes that are found in the /etc/security/user file. If the old password can open the keystore, it also changes the keystore password. That is to say, if the login and keystore passwords are same, then the passwd command changes both of the passwords. If the file system is an Encrypted File System (EFS), then the command performs as though the -a flag is specified. If you specify the -a flag, the result is that the EFS password is not synchronized with user login password after a password change. Therefore, the keystore is not be loaded automatically on next logins.

플래그

플래그 설명
-a 모든 모듈(compat, LDAP, NIS 등)에서 사용자 비밀번호를 바꿉니다. 6.1부터
-f finger가 보는 사용자 정보를 바꿉니다. /etc/passwd에 전체 이름을 넣을 때 씁니다.
-s 로그인 셸을 바꿉니다.
-R load_module 비밀번호를 바꿀 때 쓸 로드 가능한 I&A 모듈.
영어 원문
  • -a — Changes a user's password in all modules (compat, LDAP, NIS, and so on).
  • -f — Changes the user information accessed by the finger command. You can use this flag to provide your full name in the /etc/passwd file.
  • -s — Changes the login shell.
  • -R load_module — Specifies the loadable I&A module used to change a user's password.

보안

passwd는 서비스 이름이 passwd인 PAM 지원 응용 프로그램입니다. 시스템 전체에서 PAM으로 인증하게 하려면 root가 /etc/security/login.cfg의 usw 스탠자에서 auth_type을 PAM_AUTH로 바꿉니다.

PAM을 켰을 때의 인증 방법은 /etc/pam.conf의 passwd 서비스 구성에 따릅니다. passwd에는 password 모듈 유형 항목이 필요하며, 권하는 구성은 다음과 같습니다.

text
#
# AIX passwd configuration
#
passwd  password  required  /usr/lib/security/pam_aix

RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1 문서에만 있음).

영어 원문

The passwd command is a PAM-enabled application with a service name of passwd. System-wide configuration to use PAM for authentication is set by modifying the value of the auth_type attribute, in the usw stanza of /etc/security/login.cfg, to PAM_AUTH as the root user.

The authentication mechanisms used when PAM is enabled depend on the configuration for the passwd service in /etc/pam.conf. The passwd command requires /etc/pam.conf entries for the password module type. Listed below is a recommended configuration in /etc/pam.conf for the passwd service: # # AIX passwd configuration #

passwd password required /usr/lib/security/pam_aix

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.

예제

  1. 자기 비밀번호를 바꿉니다. root가 아니고 예전 비밀번호가 있으면 먼저 묻고, 새 비밀번호를 두 번 묻습니다.
bash
passwd
  1. /etc/passwd의 전체 이름을 바꿉니다. 로그인 이름 sam이면 현재 gecos를 보여 주고 바꿀지 묻습니다. Y를 넣으면 새 이름을 묻고 /etc/passwd에 기록합니다.
text
$ passwd -f
sam's current gecos:
        "Sam Smith"
Change (yes) or (no)? >
  1. 다음 로그인부터 다른 셸을 씁니다. 쓸 수 있는 셸의 경로와 지금 셸을 보여 주고 바꿀지 묻습니다. Y를 넣으면 쓸 셸을 묻습니다.
bash
passwd -s

자주 쓰는 형태:

bash
passwd app1                               # root: 사용자 비밀번호 정하기(다음 로그인 때 바꿔야 함)
echo "app1:Temp1234!" | chpasswd -c       # 스크립트로(-c는 ADMCHG를 붙임)
pwdadm -c app1                            # 플래그 지우기(ADMCHG 등)
grep -p app1: /etc/security/passwd        # 마지막 변경 시각·플래그 보기
영어 원문
  1. To change your password, type: passwd

The passwd command prompts you for your old password, if it exists and you are not the root user. After you enter the old password, the command prompts you twice for the new password.

  1. To change your full name in the /etc/passwd file, type:

passwd -f

The passwd command displays the name stored for your user ID. For example, for login name sam, the passwd command could display this message: sam’s current gecos:

"Sam Smith"

Change (yes) or no)? >

If you type a Y for yes, the passwd command prompts you for the new name. The passwd command records the name you enter in the /etc/passwd file.

  1. To use a different shell the next time you log in, type:

passwd -s

The passwd command lists the path names of the available shells and the shell you are currently using. The command also displays a prompt: Change (yes) or (no)? >

If you type a Y for yes, the passwd command prompts you for the shell to use. The next time you log in, the system provides the shell that you specify here.

파일

파일 설명
/usr/bin/passwd passwd 명령
/etc/passwd 사용자 ID, 이름, 홈 디렉터리, 로그인 셸, finger 정보
/etc/security/passwd 암호화한 비밀번호와 보안 정보
영어 원문
  • /usr/bin/passwd — Contains the passwd command.
  • /etc/passwd — Contains user IDs, user names, home directories, login shell, and finger information.
  • /etc/security/passwd — Contains encrypted passwords and security information.

Related information:

  • chfn command
  • newpass command
  • Securing the network
  • Trusted Computing Base
  • Shells 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에 둡니다. 리눅스 passwd도 passwd, passwd 사용자로 쓰고, -l·-u(잠금·해제), -e(다음 로그인 때 바꾸게, AIX ADMCHG와 같음), -S(상태)가 있습니다. 이름은 chfn, 셸은 chsh로 바꿉니다. 지금 리눅스는 SHA-512 해시라 8자 제한이 없습니다(AIX도 /etc/security/login.cfg의 pwd_algorithm으로 바꿀 수 있음).