A Micro Toolbox

ソフトウェアのニッチな問題の対処記録です

passwdコマンドのパスワードチェック方法を変える実験

RHEL5で実験。

一般ユーザでpasswdコマンドを実行すると、単純なパスワードははじかれるようになっている。

$ passwd
Changing password for user xxxx.
Changing password for xxxx
(current) UNIX password:
New UNIX password: ★abcdeなどを入力
BAD PASSWORD: it is based on a dictionary word
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
passwd: Authentication token manipulation error
$

passwdコマンドのPAM認証設定を書き換える。

# pwd
/etc/pam.d
# vi passwd
# cat passwd
#%PAM-1.0
auth       include      system-auth
account    include      system-auth
# ↓の1行コメントアウト
#password   include     system-auth
# ↓の1行追加
password   sufficient   pam_unix.so nullok md5 shadow
password   required     pam_deny.so

単純なパスワードでもエラーが出なくなる。

$ passwd
Changing password for user xxxx.
Changing password for xxxx
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
$