·터미널 명령어

passwd

권한·소유

쓰는 꼴

passwd [user]

로그인 비밀번호를 바꾸고 그 해시를 /etc/shadow에 넣습니다. macOS에는 리눅스 쪽 옵션이 거의 없어 dscl이나 설정 화면을 씁니다.

자주 쓰는 옵션

옵션
-SLinux: show the status of the account
-lLinux: lock the account so the password cannot be used
-uLinux: unlock it again
-eLinux: expire the password so it must change at next login
-dLinux: delete the password outright, which is dangerous

예시

passwd

Changes your own password; it asks for the old one first.

sudo passwd deploy

Sets another user password without knowing the old one.

sudo passwd -l olduser

Locks the account.

숫자 모드와 문자 모드가 같은 것을 가리킵니다. 755와 u=rwx,go=rx는 같은 뜻입니다.

읽는 방법

  • 대괄호 [ ]는 넣어도 되고 안 넣어도 되는 자리입니다.
  • 점 셋 …은 여러 개를 이어 쓸 수 있다는 뜻입니다.
  • 옵션은 대소문자를 가립니다 — -r과 -R이 다른 명령도 있습니다.

자주 묻는 것

Q. passwd은 무엇을 하나요?

로그인 비밀번호를 바꾸고 그 해시를 /etc/shadow에 넣습니다. macOS에는 리눅스 쪽 옵션이 거의 없어 dscl이나 설정 화면을 씁니다.

Q. 어떻게 치나요?

passwd [user] — 대괄호는 생략할 수 있는 자리입니다.

Q. 옵션은 몇 개나 자주 쓰나요?

여기 정리한 것은 5개입니다. 전체 목록은 man passwd에 있습니다. 이 명령은 권한·소유 갈래입니다.

같이 보는 명령

man 페이지: man passwd