/etc/login.defsでパスワード期限を設定する
0.改訂履歴
- 2005.08.26 新規作成
1.はじめに
このドキュメントでは,/etc/login.defsの役割の理解をし,セキュアなログイン環境を構築する手順を説明する. /etc/login.defsファイルは,shadowログイン機能に関連した定義ファイルである.
2.現状設定の確認
- まずは,現在の設定内容を確認する.
- 下記の場合,設定内容はデフォルトのままである.
[root@jupiter root]# cat /etc/login.defs # *REQUIRED* # Directory where mailboxes reside, _or_ name of file, relative to the # home directory. If you _do_ define both, MAIL_DIR takes precedence. # QMAIL_DIR is for Qmail # #QMAIL_DIR Maildir MAIL_DIR /var/spool/mail #MAIL_FILE .mail # Password aging controls: # # PASS_MAX_DAYS Maximum number of days a password may be used. # PASS_MIN_DAYS Minimum number of days allowed between password changes. # PASS_MIN_LEN Minimum acceptable password length. # PASS_WARN_AGE Number of days warning given before a password expires. # PASS_MAX_DAYS 99999 PASS_MIN_DAYS 0 PASS_MIN_LEN 5 PASS_WARN_AGE 7 # # Min/max values for automatic uid selection in useradd # UID_MIN 500 UID_MAX 60000 # # Min/max values for automatic gid selection in groupadd # GID_MIN 500 GID_MAX 60000 # # If defined, this command is run when removing a user. # It should remove any at/cron/print jobs etc. owned by # the user to be removed (passed as the first argument). # #USERDEL_CMD /usr/sbin/userdel_local # # If useradd should create home directories for users by default # On RH systems, we do. This option is ORed with the -m flag on # useradd command line. # CREATE_HOME yes [root@jupiter root]# |
- ほとんどは簡単な英語で説明が書いてあるとおりなのだが,パスワード関連の設定内容に関して以下の表にまとめる.
項目 | 意味 | 推奨設定 |
---|---|---|
PASS_MIN_LEN | パスワード長の最小文字数を設定する. |
8
|
PASS_MAX_DAYS | パスワードの有効日数.この日数が経過するまでにパスワードを変更する必要がある. |
30〜90
|
PASS_WARN_AGE | パスワード有効期限切れを警告する期間. 初期値は7で,これは7日前から警告することになる. 連休など長期不在も考慮しながら設定する. |
15
|
PASS_MIN_DAYS | パスワードを変更できない期間. 同じパスワードをしばらく使わせない設定にした場合に,即時にパスワード変更が可能な場合には |
0
|
- PASS_MAX_DAYS,PASS_MIN_DAYS,PASS_WARN_AGEはアカウントを作成する際のデフォルトであるため,既存のユーザアカウントには影響しない.