使い方: passwd [オプション...]
Usage: passwd [OPTION...]
PASSWD(1) PASSWD(1)
名前
passwd - ユーザパスワードを変更する
書式
passwd [-f|-s] [name]
passwd [-g] [-r|-R] group
passwd [-x max] [-n min] [-w warn] [-i inact] login
passwd {-l|-u|-d|-S|-e} login
説明
passwd はユーザアカウント・グループアカウントのパスワードを変更する。一
般ユーザは自分のアカウントのパスワードしか変更できない。スーパーユー ザ
は いかなるアカウントのパスワードも変更できる。グループの管理者はグルー
プのパスワードを変更できる。 passwd によって、ユーザのフルネーム・ロ グ
イ ンシェル・パスワードの期限切れの日付・有効期間といったアカウント情報
を変更することもできる。
-s オプションを指定すると passwd は chsh を呼び出してユーザのシェルを変
更 する。 -f オプションを指定すると passwd は chfn を呼び出してユーザの
GECOS 情報を変更する。これらの 2 つのオプションは互換性のためだけにある
。 chsh や chfn を直接呼び出しても構わない。
パスワードの変更
パ スワードが既にある場合は、まず古いパスワードを入力するよう促される。
入力されたパスワードは暗号化され、記録されているものと照合される。正 し
いパスワードを 1 回で入力しなくてはならない。スーパーユーザは、パスワー
ドを忘れてしまった際の変更も行なえる様に、このステップを省略できる。
パスワードが入力された後、パスワード有効期限の情報を調べ、現在パスワ ー
ド の 変更が許されているか検査する。もし許可されていない場合は、 passwd
は変更を拒否して終了する。
次にユーザは、置き換えるパスワードを入力するよう促される。入力された パ
ス ワードは、充分複雑かどうか検査される。一般的な指針としては、パスワー
ドは以下の集合それぞれから一つ以上の文字を使った 6 から 8 文字のもの に
すべきである。
小文字のアルファベット
大文字のアルファベット
0 から 9 までの数字
句読点
シ ステムのデフォルトの消去文字や kill 文字を含めないように注意すること
。 passwd はあまりに単純なパスワードへの変更は拒否する。
入力したパスワードが受け入れられた場合、 passwd はもう一度入力を促し 、
二 番目に入力したものを最初のものと比較する。パスワード変更が受け入れら
れるためには、この両者が合致しなくてはならない。
グループパスワード
-g オプションを用いた場合、指定したグループのパスワードが変更される。こ
の オプションはスーパーユーザか指定したグループの管理者しか使えない。現
在のグループパスワードは尋ねてこない。 -g オプションを -r オプション と
と もに用いると、指定したグループのパスワードが削除される。こうすると全
てのメンバーがこのグループにアクセスできるようになる。 -R オプション を
-g オプションとともに用いると、全てのユーザに対して指定したグループへの
アクセスを禁止できる。
パスワードの有効期限情報
スーパーユーザは、パスワードの有効期限に関する情報を変更できる。これ に
は -x, -n, -w, -i などのオプションを用いる。 -x オプションはパスワード
が有効な最長日数を設定するのに用いられる。 max 日が過ぎるとパスワードを
変 更するように求められる。 -n オプションはパスワードが変更可能となるま
での最短日数を設定するのに用いられる。ユーザは min 日が経過した後でない
と パスワードを変更できない。 -w オプションはパスワードの使用期限が来る
前に何日間警告を与えるかを設定するために用いられる。期限切れの warn 日
前 から注意が開始され、パスワードが期限切れになるまであと何日残っている
かが示される。 -i オプションは、パスワードの期限が切れてから何日間経 過
し た ら 、そのアカウントを使用不能の状態にするかを設定するのに用いる。
inact 日間アカウントをパスワード期限切れ状態のままにすると、ユーザは そ
のアカウントに入れなくなる。
あ るアカウントのパスワードを直ちに期限切れにしたい場合は、 -e オプショ
ンを用いればよい。するとそのユーザは次にログインする際にパスワードを 変
更 するよう強制される。 -d オプションを使って、ユーザのパスワードを削除
することもできる (パスワードが空になる)。このオプションは注意して使うこ
と 。これを使うと、そのアカウントはログインにパスワードを全く必要としな
くなり、システムが侵入者に対してオープンになってしまう。
アカウントの保守
-l フラグと -u フラグを用いると、ユーザアカウントをロックしたり、そのロ
ッ クを外したりできる。 -l オプションを用いると、パスワードフィールドの
値は暗号化された如何なる値ともマッチしなくなり、アカウントは使用不能 に
な る。 -u オプションを用いると、パスワードは以前の値に戻り、アカウント
が再び使用可能となる。
-S オプションを用いるとアカウントの状態が表示される。アカウントの状態の
情報は 6 つの部分からなる。最初の部分は、アカウントにロックがかけられて
いる (L)、パスワードが存在しない (NP)、もしくは使用可能なパスワードがあ
る (P) といった情報を示す。 2 番目は最後にパスワードが変更された日付を
示す。残りの4つの部分はそれぞれパスワードの最短期限、最長期限、警告期間
、使用不能期間である。
ユーザパスワードに対するヒント
パ スワードの安全性は暗号化アルゴリズムの強力さとキー空間の大きさに依存
する。 UNIX のシステム暗号化の方法は NBS DES アルゴリズムに基づいており
、 非常に安全性が高い。キー空間の大きさは選ばれたパスワードのランダムさ
に依存する。
パスワードの安全性が脅かされるのは、大抵の場合パスワードの選択や扱い が
不 注意なためである。従ってパスワードとしては、辞書に載っているものや書
き留めなければならないものは避けるべきである。また、固有名詞・免許証 番
号 ・誕生日・自宅の住所などをパスワードにするのも避けるべきである。これ
らはいずれもシステムセキュリティを破る際に、推量情報に用いられる可能 性
があるからである。
パ スワードは紙片に書き留めておく必要が無いよう、簡単に思い出せるものに
しなくてはならない。これは例えば、短い二つの単語をくっつけて、その間 に
特殊記号や数字を挟み込むことによって作れる。例えば Pass%word など。
他 の作り方としては、文学作品などから思い出しやすい句を選び出し、それぞ
れの単語から最初もしくは最後の文字を抜き出す方法がある。この方法の例 と
しては、
Ask not for whom the bell tolls.
という句から
An4wtbt. というパスワードが作り出せる。
ク ラッカーの辞書には、こんな語句は載っていなさそうだ、とみなしても良い
だろう。しかし、ここに示した方法だけに頼るのではなく、自分独自のパス ワ
ードの作り方を考え出すべきである。
グループのパスワードに関する注意
グ ループパスワードは、一人以上の人間が知ることが許されるものであるから
、本質的にセキュリティ上の問題を抱えている。しかしグループを使えば別 々
の人間が共同で作業する事ができるので、これは便利なツールではある。
警告
全 てのオプションが使えるようには設定されていないかもしれない。パスワー
ドの複雑さの検証はサイトによって異なるだろう。ユーザはシステムが満足 す
るような、充分複雑なパスワードを選ぶよう強制される。 NIS が動作していて
、かつ NIS サーバ以外にログインしているユーザは、パスワードを変更できな
い。 (訳注: この場合 yppasswd(8) を用いる。)
ファイル
/etc/passwd - ユーザアカウント情報
/etc/shadow - 暗号化されたユーザパスワード
関連項目
group(5), passwd(5)
著者
Julianne Frances Haugh
PASSWD(1) User utilities PASSWD(1)
NAME
passwd - update user’s authentication tokens
SYNOPSIS
passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w
warndays] [-i inactivedays] [-S] [--stdin] [username]
DESCRIPTION
The passwd utility is used to update user’s authentication token(s).
This task is achieved through calls to the Linux-PAM and Libuser API.
Essentially, it initializes itself as a "passwd" service with Linux-PAM
and utilizes configured password modules to authenticate and then
update a user’s password.
A simple entry in the global Linux-PAM configuration file for this ser-
vice would be:
#
# passwd service entry that does strength checking of
# a proposed password before updating it.
#
passwd password requisite pam_cracklib.so retry=3
passwd password required pam_unix.so use_authtok
#
Note, other module types are not required for this application to func-
tion correctly.
OPTIONS
-k The option -k, is used to indicate that the update should only
be for expired authentication tokens (passwords); the user
wishes to keep their non-expired tokens as before.
-l This option is used to lock the specified account and it is
available to root only. The locking is performed by rendering
the encrypted password into an invalid string (by prefixing the
encrypted string with an !).
--stdin
This option is used to indicate that passwd should read the new
password from standard input, which can be a pipe.
-u This is the reverse of the -l option - it will unlock the
account password by removing the ! prefix. This option is avail-
able to root only. By default passwd will refuse to create a
passwordless account (it will not unlock an account that has
only "!" as a password). The force option -f will override this
protection.
-d This is a quick way to delete a password for an account. It will
set the named account passwordless. Available to root only.
-e This is a quick way to expire a password for an account. The
user will be forced to change the password during the next login
attempt. Available to root only.
-n This will set the minimum password lifetime, in days, if the
user’s account supports password lifetimes. Available to root
only.
-x This will set the maximum password lifetime, in days, if the
user’s account supports password lifetimes. Available to root
only.
-w This will set the number of days in advance the user will begin
receiving warnings that her password will expire, if the user’s
account supports password lifetimes. Available to root only.
-i This will set the number of days which will pass before an
expired password for this account will be taken to mean that the
account is inactive and should be disabled, if the user’s
account supports password lifetimes. Available to root only.
-S This will output a short information about the status of the
password for a given account. Available to root user only.
Remember the following two principles
Protect your password.
Don’t write down your password - memorize it. In particular,
don’t write it down and leave it anywhere, and don’t place it in
an unencrypted file! Use unrelated passwords for systems con-
trolled by different organizations. Don’t give or share your
password, in particular to someone claiming to be from computer
support or a vendor. Don’t let anyone watch you enter your
password. Don’t enter your password to a computer you don’t
trust or if things Use the password for a limited time and
change it periodically.
Choose a hard-to-guess password.
passwd through the calls to the pam_cracklib PAM module will try
to prevent you from choosing a really bad password, but it isn’t
foolproof; create your password wisely. Don’t use something
you’d find in a dictionary (in any language or jargon). Don’t
use a name (including that of a spouse, parent, child, pet, fan-
tasy character, famous person, and location) or any variation of
your personal or account name. Don’t use accessible information
about you (such as your phone number, license plate, or social
security number) or your environment. Don’t use a birthday or a
simple pattern (such as backwards, followed by a digit, or pre-
ceded by a digit. Instead, use a mixture of upper and lower case
letters, as well as digits or punctuation. When choosing a new
password, make sure it’s unrelated to any previous password. Use
long passwords (say at least 8 characters long). You might use
a word pair with punctuation inserted, a passphrase (an under-
standable sequence of words), or the first letter of each word
in a passphrase.
These principles are partially enforced by the system, but only partly
so. Vigilence on your part will make the system much more secure.
EXIT CODE
On successful completion of its task, passwd will complete with exit
code 0. An exit code of 1 indicates an error occurred. Textual errors
are written to the standard error stream.
CONFORMING TO
Linux-PAM (Pluggable Authentication modules for Linux).
FILES
/etc/pam.d/passwd - the Linux-PAM configuration file
BUGS
None known.
SEE ALSO
pam(8), pam.d(5), libuser.conf(5), and pam_chauthtok(3).
For more complete information on how to configure this application with
Linux-PAM, see the Linux-PAM System Administrators’ Guide.
AUTHOR
Cristian Gafton
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa