月9800円~専用サーバーレンタル プロ流のホスティング

index.jpg 専用サーバーサイトマップ 専用サーバーお申し込み 専用サーバーProServer 専用サーバー見積もり

パスワードを変更するには

Linux アカウントのパスワードを変更するには、「passwd」コマンドを実行します。 誰のパスワードを変更するか?という点を常に意識してください。ログインしたアカウントのパスワードを変更する場合には、単に、passwd コマンドを実行すれば良いでしょう。 しかし、ログインしたアカウントとはことなるアカウントのパスワードを変更する場合には、su コマンドでパスワードを変更するユーザーになってから、行うか、rootになってpasswdコマンドを実行します。

 

passwd

 

[sample@www ~]$ passwd
Changing password for user sample.
Changing password for sample
(current) UNIX password: <-現在のパスワードを入力する。タイプしても画面はなにも代わらないが、正しくタイプしてエンターする。
New UNIX password: <-新しいパスワードをタイプ
BAD PASSWORD: is too similar to the old one <-変更前に似ていると拒否される
New UNIX password:
BAD PASSWORD: it is WAY too short <-短すぎると拒否される
New UNIX password:
BAD PASSWORD: it is based on a dictionary word <-辞書にある単語で構成されていると拒否される
passwd: Authentication token manipulation error <-パスワードの変更に失敗

 

[sample@www ~]$ passwd
Changing password for user sample.
Changing password for sample
(current) UNIX password:
passwd: Authentication token manipulation error <-現在利用中のパスワードを間違えた場合

 

[sample@www ~]$ passwd
Changing password for user sample.
Changing password for sample
(current) UNIX password:
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully. <-パスワードの変更に成功

[sample@www ~]$ su -
Password:
[root@www ~]# passwd sample
Changing password for user sample. <-現在のパスワードを聞いてこない
New UNIX password:
BAD PASSWORD: it is based on a dictionary word <-辞書に基づくパスワードだと警告を受けるが、そのまま入力
Retype new UNIX password:
passwd: all authentication tokens updated successfully. <-辞書に基づくパスワードでもrootが良いと言うのなら、通ってしまう

 

補足:

パスワードを入力中にミスタイプしてしまった場合は、"ctrl+u" を押します。画面には変化が起きませんが、タイプしたものがクリアされていますので、最初からタイプしてください。

 

rootがpasswdコマンドを利用する場合、現在利用中のパスワードを知らなくとも、上書きする事ができます。また、脆弱なパスワードでも、スーパーユーザーであるrootが許可するのであれば、利用することができてしまいます。

 

passwd コマンドについて詳しく調べる場合は、ご利用のサーバでman コマンドを実行するのが確実です。

[root@www ~]# man passwd

PASSWD(1) User utilities PASSWD(1)

NAME
passwd - update a user's authentication tokens(s)

SYNOPSIS
passwd [-k] [-l] [-u [-f]] [-d] [-n mindays] [-x maxdays] [-w warndays]
[-i inactivedays] [-S] [--stdin] [username]

DESCRIPTION
Passwd is used to update a user's authentication token(s).

Passwd is configured to work through the Linux-PAM API. Essentially, it
initializes itself as a "passwd" service with Linux-PAM and utilizes con-
figured password modules to authenticate and then update a user's pass-
word.

A simple entry in the Linux-PAM configuration file for this service would
be:

#
# passwd service entry that does strength checking of
# a proposed password before updating it.
#
passwd password requisite \
/usr/lib/security/pam_cracklib.so retry=3
passwd password required \
/usr/lib/security/pam_unix.so use_authtok
#

Note, other module-types are not required for this application to function
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 avail-
able 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 available to root
only. By default passwd will refuse to create a passwordless
account (it will not unlock an account that has only "!" as a pass-
word). The force option -f will override this protection.

-d This is a quick way to disable a password for an account. It will
set the named account passwordless. 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 pass-
word 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 unen-
crypted file! Use unrelated passwords for systems controlled 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 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,
fantasy 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 preceded
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 pass-
words (say 8 characters long). You might use a word pair with
punctuation inserted, a passphrase (an understandable 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).
Note, if your distribution of Linux-PAM conforms to the Linux Filesystem
Standard, you may find the modules in /lib/security/ instead of
/usr/lib/security/, as indicated in the example.

FILES
/etc/pam.d/passwd - the Linux-PAM configuration file

BUGS
None known.

SEE ALSO
pam(8), and pam_chauthok(2).

For more complete information on how to configure this application with
Linux-PAM, see the Linux-PAM System Administrators' Guide at
/usr/share/doc/pam...

AUTHOR
Cristian Gafton <gafton@redhat.com>

Red Hat Linux Aug 23 2004 PASSWD(1)



 

1つ前のページへ戻る

専用サーバーサポートのトップ

専用サーバーのProServer.jpホームページへ戻る