반응형
<passwd>
등록된 사용자의 암호를 지정하거나 변경하는 명령어
암호 변경 권한 차이
- root 사용자 : 모든 사용자의 암호를 변경 가능
- 일반 사용자 : 자신의 암호만 변경 가능
암호 변경 시 이전 암호 입력 여부
- root 사용자 : 암호 변경시 이전 암호 물어보지 않고 변경 가능
- 일반 사용자 : 이전 암호를 반드시 맞추어야만 새로운 암호 입력 가능
[root@localhost /]# passwd --help
Usage: passwd [OPTION...] <accountName>
-k, --keep-tokens keep non-expired authentication tokens
-d, --delete delete the password for the named account (root only)
-l, --lock lock the password for the named account (root only)
-u, --unlock unlock the password for the named account (root only)
-e, --expire expire the password for the named account (root only)
-f, --force force operation
-x, --maximum=DAYS maximum password lifetime (root only)
-n, --minimum=DAYS minimum password lifetime (root only)
-w, --warning=DAYS number of days warning users receives before password expiration (root only)
-i, --inactive=DAYS number of days after password expiration when an account becomes disabled (root only)
-S, --status report password status on the named account (root only)
--stdin read new tokens from stdin (root only)
Help options:
-?, --help Show this help message
--usage Display brief usage message
2. passwd
[root@localhost /]# passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost /]# passwd user01
Changing password for user user01.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
3. stdin 옵션 사용
[root@localhost ~]# echo 'kibank11@@' | passwd --stdin user01
Changing password for user user01.
passwd: all authentication tokens updated successfully.
4. 계정 잠그기
[root@server1 ~]# grep usr_te01 /etc/shadow
usr_te01:$6$OkNRlQko$RpxEEjkwffofwx54k4iN.431rRMUS0/ygKwa5An44Qwda2MtHJA94eWv8wVkZHExuqsNIFTFcgt6E0nJ18sxB0:19065:0:30:7:::
[root@server1 ~]# passwd -l usr_te01
Locking password for user usr_te01.
passwd: Success
[root@server1 ~]# grep usr_te01 /etc/shadow
usr_te01:!!$6$OkNRlQko$RpxEEjkwffofwx54k4iN.431rRMUS0/ygKwa5An44Qwda2MtHJA94eWv8wVkZHExuqsNIFTFcgt6E0nJ18sxB0:19065:0:30:7:::
패스워드정보 앞부분에 !!가 들어가면서 계정이 잠긴다.
5. 계정 잠금 해제
[root@server1 ~]# grep usr_te01 /etc/shadow
usr_te01:!!$6$OkNRlQko$RpxEEjkwffofwx54k4iN.431rRMUS0/ygKwa5An44Qwda2MtHJA94eWv8wVkZHExuqsNIFTFcgt6E0nJ18sxB0:19065:0:30:7:::
[root@server1 ~]# passwd -u usr_te01
Unlocking password for user usr_te01.
passwd: Success
[root@server1 ~]# grep usr_te01 /etc/shadow
usr_te01:$6$OkNRlQko$RpxEEjkwffofwx54k4iN.431rRMUS0/ygKwa5An44Qwda2MtHJA94eWv8wVkZHExuqsNIFTFcgt6E0nJ18sxB0:19065:0:30:7:::
패스워드정보 앞부분에 !!가 해제되면서 계정이 풀린다.
6. 패스워드 삭제하기
[root@server1 ~]# grep usr_te01 /etc/shadow
usr_te01:$6$OkNRlQko$RpxEEjkwffofwx54k4iN.431rRMUS0/ygKwa5An44Qwda2MtHJA94eWv8wVkZHExuqsNIFTFcgt6E0nJ18sxB0:19065:0:30:7:::
[root@server1 ~]# passwd -d usr_te01
Removing password for user usr_te01.
passwd: Success
[root@server1 ~]# grep usr_te01 /etc/shadow
usr_te01::19067:0:30:7:::
반응형
'CentOS > Study' 카테고리의 다른 글
[사용자관련파일]/etc/shadow (0) | 2022.03.14 |
---|---|
[사용자계정관리]su (0) | 2022.03.13 |
[사용자관련파일]skel (0) | 2022.03.13 |
[사용자계정관리]useradd (0) | 2022.03.13 |
[Linux]Transaction check error (0) | 2022.02.12 |