Parent Directory | Revision Log
added retype
#!/usr/bin/perl #*************************************************************************** # ZEPTOOS:zepto-info # This file is part of ZeptoOS: The Small Linux for Big Computers. # See www.mcs.anl.gov/zeptoos for more information. # ZEPTOOS:zepto-info # # ZEPTOOS:zepto-fillin # $Id: mkpasswd.pl,v 1.14 2005/08/25 19:54:57 kazutomo Exp $ # ZeptoOS_Version: DEVELOPMENT-PRERELEASE # ZeptoOS_Heredity: FOSS_ORIG # ZeptoOS_License: GPL # ZEPTOOS:zepto-fillin # # ZEPTOOS:zepto-gpl # Copyright: Argonne National Laboratory, Department of Energy, # and University of Chicago. 2004, 2005 # ZeptoOS License: GPL # # This software is free. See the file ZeptoOS/misc/license.GPL # for complete details on your rights to copy, modify, and use this # software. # ZEPTOOS:zepto-gpl #*************************************************************************** # This small program creates a passwd file in the current directory # which is copied by create-ramdisk.sh to new ramdisk. The password # file contains three users: root, your username and nobody. root and # your username entry have a plain passwd string crypted from passwd # you entered. # NOTE: don't use important password. A plain crypted string stored # into passwd file. use strict; use English; my $username = getpwuid($UID); my $word; PASSENTRY: print "Please enter temporary password for users on ramdisk\n"; # root and $username system "stty -echo"; print "New password:"; chomp($word = <STDIN>); if( length($word) < 6 ) { system "stty echo"; printf "\npasswd is too short!\n\n"; goto PASSENTRY; } print "\n"; system "stty -echo"; print "Retype new password:"; my $word2; chomp($word2 = <STDIN>); system "stty echo"; if( $word != $word2 ) { print "\nsorry. password does not match.\n"; goto PASSENTRY; } my $salt = join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64] ; my $passwd = crypt( $word, $salt ) ; system "stty echo"; my $passwdfn = "ramdisk-passwd"; open(FH, ">${passwdfn}") or die "Unable to open ${passwdfn}"; print FH "root:${passwd}:0:0:root:/:/bin/sh\n"; print FH "${username}:${passwd}:${UID}:100:${username}:/:/bin/sh\n"; print FH "rpcuser:*:29:29:RPC Service User:/var/lib/nfs:\n"; print FH "sshd:*:74:74:Privilege-separated SSH:/var/empty/sshd:/bin/sh\n"; print FH "nobody:*:99:99:Nobody:/:\n"; close(FH); my $pwd = `pwd`; chomp($pwd); print "\n${pwd}/${passwdfn} has been created.\n"; exit 0;
No CVS admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.1 |