passwd
パーミッション
書き方
passwd [user]ログイン用の暗証を変え、そのハッシュを /etc/shadow に入れます。macOS には Linux 側の指定がほとんど無く、dscl や設定画面を使います。
よく使うオプション
| オプション | 意味 |
|---|---|
| -S | Linux: show the status of the account |
| -l | Linux: lock the account so the password cannot be used |
| -u | Linux: unlock it again |
| -e | Linux: expire the password so it must change at next login |
| -d | Linux: delete the password outright, which is dangerous |
例
passwdChanges your own password; it asks for the old one first.
sudo passwd deploySets another user password without knowing the old one.
sudo passwd -l olduserLocks 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