Re: lug-bg: Date: Fri, 15 Dec 2000 (adduseradd)
- Subject: Re: lug-bg: Date: Fri, 15 Dec 2000 (adduseradd)
- From: i.kolemanov@xxxxxxxx (ISM Kolemanov, Ivan)
- Date: Fri, 15 Dec 2000 11:03:04 +0100
Puskam tova s ideqta che nqkoj ste go izpolzva,
a drug ste napravi podobreniq :)
Tova e script kojto napravih da se izpolzva v edno uchiliste
za samba-tng (windows PDC :)
scripta convertira txt file win->unix, normalno sa mi go pisali s notepad,
vzima ot txt file parvo i familno ime i grupa, koito sa razdeleni s ":"
(tova mozesh da go promenish),
convertira vsichko do malki bukvi,
pravi user ime ot 1 symbol na parvo ime + "_" + 10 symvola ot poslednoto ime
(NT ima ograchenie do 12 symvola za da vleze v domain :),
sled koeto pravi parola ot parvoto ime
sazdava direktorii i t.n.
razgledaj go ako ste svarshi rabota
########################################################
#---------------------------------------------------------------------------
------
# smbusers.pl
#---------------------------------------------------------------------------
------
# author Ivan Kolemanov
# every and anybody can change it, without to ask me
#---------------------------------------------------------------------------
------
# don't forget I'm totally not responsible
# for the demage of your live, your good nights and so on
#---------------------------------------------------------------------------
------
#!/usr/bin/perl -i
$samedit = "/opt/samba-tng/bin/samedit";
$dateiname = "smbusers.txt";
`./win2unix_txt.pl $dateiname`;
$separator = ':'; # evtl. \t usw...
@fieldList = ();
open(FILE,$dateiname);
while (<FILE>) {
chomp $_;
($ufname,$ulname,$group) = split(/$separator/, $_);
$fieldList = [$ufname,$ulname,$group];
foreach ($fieldList) {
local($password)=lc($ufname);
local($salt)="hm";
local($cryptpw)=crypt($password,$salt);
$shadow = $cryptpw;
$ufname1=substr($ufname,0,1);
$ulname1=substr($ulname,0,10);
$username=lc($ufname1 . "_" . $ulname1);
`cp ./class1.bat /home/smb/netlogon/$group.bat`;
print"name:$username passwd:$shadow group:$group \n";
`/usr/sbin/groupadd $group`;
`/bin/mkdir -p /home/smb/users/$group`;
`/bin/chown root.$group /home/smb/users/$group`;
$homedir="/home/smb/users/$group/$username";
`/usr/sbin/useradd $username -g $group -d $homedir -p $shadow `;
`/bin/chown -R $username.$group $homedir`;
`$samedit -S . -U root -N -c 'createuser $username -p $password'`;
`/usr/sbin/edquota -p test $username`;
`/bin/chmod 755 $homedir`;
`/bin/mkdir -p -m 755 $homedir/public`;
`/bin/chown $username.$group $homedir/public`;
}
}
close(FILE);
#---------------------------------------------------------------------------
------------------------
#---------------------------------------------------------------------------
------------------------
smbusers.txt - vseki greshen simvol moze da ti svarshi porazii
smbusers.pl e dosta tap, taka che vzima vseki imput i dejstva
#---------------------------------------------------------------------------
------------------------
ivan:kolemanov:ism
test:test:guest
haho:hahov:admin
#---------------------------------------------------------------------------
------------------------
#---------------------------------------------------------------------------
------------------------
#---------------------------------------------------------------------------
------------------------
win2unix_text_pl
tova e ot mailista, umnite i ucheni hora pomagat (blagodarq;)
#---------------------------------------------------------------------------
-----------------------
#!/usr/bin/perl -i
while (<>) {
tr/\r//d;
print;
}
#---------------------------------------------------------------------------
-----------------------
-----Ursprungliche Nachricht-----
Von: Ivan Donchev [mailto:azbest@xxxxxxxxx]
Gesendet: Freitag, 15. Dezember 2000 10:51
An: lug-bg@xxxxxxxxxxxxxxxxxx
Betreff: lug-bg: Date: Fri, 15 Dec 2000 10:57:09 +0200
Zdraveite,
Ot skoro zapo4nah da rabotq s Linux i vse pove4e mi haresva :)))
Oba4e, kak moga da avtomatiziram addvaneto na useri, dokato bqha malko tova
stavashe lesno no sega trqbva da add nqkolko stotin i nqmam ideq kak moga da
go napravq, osobenno kogato im slagam passwords :(
ako moje pomognete mom4eta.
Ivan Donchev
==================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
Otpiswaneto RABOTI !!! : Majordomo@xxxxxxxxxxxxxxxxxx UNSUBSCRIBE LUG-BG
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora
|