Eric Harrison wrote a perl script for me to create a password file. I needed one that would create a password file of all the students in the school, without me having to hand input the names and passwords. Eric did this and it worked great. It created a name and password for each student. The only problem is that it does not create a shadow file. Without the shadow file, we cannot access the names that have been created. I have been working on this for almost two years, but I know I am getting closer to having a finish product that I can use without a lot of fuss. I needed something that is easy to use and others can use if I am not here. I tried using some other suggestions, but I couldn't seem to get them working and you still had to create the password yourself. This I did not want to do with almost 1,300 names.
I still need to add to the shadow file and samba
password file. I have a lot of Windows 98 and 2000
machines. The Windows 98 machines are easy to use,
but the Windows 2000 machines are real stinkers. I
still haven't figured what and how I need to do to
connect these machines to my LTSP servers. In Windows
2000 you have to log in and it looks at a file on the
computer, but I want it to look at the server. I need
to learn how to do this. I received recommendations
earlier, but I couldn't quiet figure out what to do. Can someone give me directions that are very simple.
Here is the script that Eric wrote for me that creates the password file. Can someone tell me how to add the shadow file, and to create the smbpasswd file by adding to this script to creating a new one.
#!/usr/bin/perl
# # 1 = first name, last initial, graduation year # 2 = first initial, last name, graduation year # 3 = first name, last name $UserNameType = 2;
open (PW, "</etc/passwd"); open (OUT,">>/root/password_list"); while (<PW>) { chomp; ($uid,$junk) = split /:/, $_; $seen{$uid} = 1; }
while (<>) { chomp; s/ //g; s/ /-/g; s,/,-,g; s/'//g; $i = "2"; ($fn, $ln, $grad) = split /,/, $_; chomp $grad; if ($UserNameType == 3) { $username = lc("$fn_$ln"); while ($seen{$username}) { $username = lc("$fn_$ln$i"); $i++; } } elsif ($UserNameType == 2) { $start = substr($fn, 0, 1); $end = substr($ln, 0, 7); $username = lc("$start$end$grad"); while ($seen{$username}) { $username = lc("$start$end$i$grad"); $i++; } } else { $end = substr($ln, 0, 1); $username = lc("$fn$end$grad"); while ($seen{$username}) { $username = lc("$fn$end$i$grad"); $i++; } } ($password, $cypher) = &mkpass; print OUT "$fn $ln => $username $password\n"; print "creating user $username\n"; `/usr/sbin/adduser -p $cypher $username`; `/usr/bin/smbpasswd -a $username $password`; $seen{$username}=1; }
sub mkpass { $pass = ""; $vstr=("aeiou"); $cstr=("bcdfghjkmnprstvwxz"); $Cstr=("bcdfghjkmnprstvwxz");
for($i=1;$i<=6;$i++){
$pass.=substr($Cstr,(int(rand(18))+1),1);
$i++;
$pass.=substr($vstr,(int(rand(4))+1),1);
$i++;
$pass.=substr($cstr,(int(rand(17))+1),1);
}
chop $pass;
$salt=substr($cstr,(int(rand(17))+1),2);
$cypher=crypt($pass,$salt);
@passwords=($pass,$cypher);
return @passwords
}
Thank you for all of your help, it has really helped
me in setting up my 5 LTSP servers and serving an
entire high school.
Jennifer
__________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com
_______________________________________________ K12OSN mailing list K12OSN redhat com https://listman.redhat.com/mailman/listinfo/k12osn For more info see <http://www.k12os.org>