passwd

パーミッション

書き方

passwd [user]

ログイン用の暗証を変え、そのハッシュを /etc/shadow に入れます。macOS には Linux 側の指定がほとんど無く、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 には Linux 側の指定がほとんど無く、dscl や設定画面を使います。

Q. どう打ちますか。

passwd [user] — 角括弧は省いてよい部分です。

Q. よく使うオプションはいくつですか。

ここにまとめたのは5個です。全部は man passwd にあります。このコマンドはパーミッションの仲間です。

関連するコマンド

man ページ: man passwd