柳澤です。
On Wed, 19 Dec 2007 17:31:38 +0900
[メールアドレス保護]
wrote:
> /etc/pw.conf にて
> defaultpasswd = "random"
> と指定した状態で、pw useradd ユーザ名 -m を実行すると、
> pw の返り値で、ランダムなパスワード(15文字程度)が得ら
> れます。
>
> この(ランダムな)パスワードの長さを(例えば8文字程度に)
> 調整する方法はないのでしょうか?
ありません。
/usr/src/usr.sbin/pw/pw_user.cの次の行を見る限り、
プログラムによって長さが8〜15文字にされているようです。
1097 l = (arc4random() % 8 + 8); /* 8 - 16 chars */
1098 pw_getrand(rndbuf, l);
1099 for (i = 0; i < l; i++)
1100 pwbuf[i] = chars[rndbuf[i] % (sizeof(chars)-1)];
1101 pwbuf[i] = '\0';
1102
1103 /*
1104 * We give this information back to the user
1105 */
1106 if (getarg(args, 'h') == NULL && getarg(args, 'H') ==
NULL &&
1107 getarg(args, 'N') == NULL) {
1108 if (isatty(STDOUT_FILENO))
1109 printf("Password for '%s' is: ", user);
1110 printf("%s\n", pwbuf);
1111 fflush(stdout);
1112 }
--
-------------------------------------------------------
Yoshisato YANAGISAWA
<[メールアドレス保護]>
Dept. of Mathematical and Computing Sciences,
Graduate School of Information Science and Engineering,
Tokyo Institute of Technology.
/* If you are an *BSD user, let's join http://bsdstats.org/ */