Newsgroups: fj.questions.unix
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!sinfony-news01!news01.so-net.or.jp!infosphere!asakanet!axion!asakagw!fiaskry!sakunami!ayashi!kaneko
From: kaneko@ccedu.sendai-ct.ac.jp (Yutaka Kaneko)
Subject: Re: UNIX$B$G$N%P%C%A%f!<%6EPO?J}K!(B
X-Nntp-Posting-Host: saikachi
Message-ID: <E7L6rA.LC6@ayashi.cc.sendai-ct.ac.jp>
Lines: 55
Sender: news@ayashi.cc.sendai-ct.ac.jp (SNCT NetNews Manager)
Organization: Sendai National College of Technology
X-Newsreader: mnews [version 1.18PL3] 1994-08/01(Mon)
References: <01bc350c$b18081c0$46a187d2@jinno.globe.or.jp>
Date: Tue, 25 Mar 1997 06:45:10 GMT
Xref: galaxy.trc.rwcp.or.jp fj.questions.unix:6837
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.questions.unix&nb=6837&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

  $B6b;R!w@gBfEEGH$G$9!#(B

In article <01bc350c$b18081c0$46a187d2@jinno.globe.or.jp>
jinno@po.globe.or.jp writes:
>> $B?@Ln!wElMN>pJs%7%9%F%`$H?=$7$^$9!#(B

>> $B$3$N$?$S!"(BHP-UX10.10$B$G%f!<%6%U%!%$%k$+$i%P%C%AEPO?$r9T$&;EAH$_$r9M$($F$$$^(B
>> $B$9!#$3$N;~!"%Q%9%o!<%I$b%P%C%A$GEPO?$7$?$$$H9M$($F$$$^$9!#$3$N$h$&$J;EAH$_(B
>> $B$O2DG=$G$7$g$&$+!#(B
>>  $B$I$J$?$+!"$3$&$$$C$?$47P83$N$"$kJ}!"$h$m$7$/$*4j$$?=$7>e$2$^$9!#(B

  perl$B$r;H$C$F%9%/%j%W%H$r=q$/$N$,4JC1$G$7$g$&!#(B

  HP-UX$B$K(Bshadow$B%U%!%$%k$,$"$k$+$I$&$+CN$i$J$$$s$G$9$,!"(B
shadow$B$r;H$o$J$$$N$G$"$l$P!"%f!<%6%U%!%$%k$K!"%"%+%&%s%H!"%Q(B
$B%9%o!<%I!";aL>$,(BTAB$B$G6h@Z$i$l$FF~$C$F$$$k$H$7$F!"<!$N$h$&$J(B
$B46$8$G$I$&$G$7$g$&!)!#(B

  /etc/shadow$B$r@8@.$9$k>l9g$b!"(Bcrypt$B$K$h$k0E9f2=$NItJ,$O$=$N(B
$B$^$^;H$($k$N$G!"$A$g$C$H<jD>$7$7$F$b$i$($PBg>fIW$@$H;W$$$^(B
$B$9!#(B

--- cut here --- cut here --- cut here ---
#!/usr/local/bin/perl
$uidbase = 1000;
$homebase = "/home/";
$shell="/usr/bin/csh";
$gid = 1000;

&init;
&main;

sub main {
    $uid = $uidbase;
    while(<>) {
chop;
($user, $pass, $name) = split("\t", $_);
$pass=crypt($pass, &mkkey);
$home=$homebase.$user;
printf("%s:%s:%d:%d:%s:%s:%s\n",
    $user, $pass, $uid, $gid, $name, $home, $shell);
$uid ++;
    }
}

sub init {
    $tbl="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
    srand(time);
}

sub mkkey {
    $x = int(rand(4096));
    return substr($tbl, int($x/64), 1). substr($tbl, $x%64, 1);
}
--- cut here --- cut here --- cut here ---
