(no subject)

McEldowney, Michael MMcEldowney at deltaregional.com
Thu Apr 12 16:22:20 GMT 2001


This perl script is for Samba 2.0.7 installed via RPM.  If that's your
setup, this will work for you.  Before you run it you need to create a
Unix group with a gid of 500.  You can name it whatever you want, but
it's for machine accounts, so I would suggest you call it 'machines'. 
If you need any help with it or need it customized for you, let me know.
 
-- Mike
 
Script starts on next line:
#!/usr/bin/perl -w
 
open(FILE1, "//etc//samba//smbpasswd");
open(FILE2, ">//etc//samba//importerrors.txt");
open(FILE3, ">//etc//samba//importtest.txt");
 
while ( $input = <FILE1> ) {
 
 if ( $input =~ /^(#|$)/ ) { next; } #ignore commented out or blank
lines
 ($un, $uid, $therest) = split( /:/, $input );
 if ( $un =~ /^\d/ ) {
  print FILE2 "Cannot add user $un, the username must start with an
alpha character.\n";
 }
 elsif ( $un =~ /\s/ ) {
  print FILE2 "Cannot add user $un, the username must not contain
spaces.\n";
 }
 else {
  if ( $un =~ /\$$/ ) { #machine accounts need to be added differently
   system("//usr//sbin//adduser -u $uid -g 500 -d //dev//null -n $un");
   print FILE3 "Added machine $un.\n";
  }
  else {
   system("//usr//sbin//adduser -u $uid -g 100 -n $un");
   print FILE3 "Added user $un.\n";
  }
 }
}
 
close FILE1;
close FILE2;
close FILE3;


-----Original Message-----
From: sina [mailto:rogerwoo7508 at sina.com.cn]
Sent: Thursday, April 12, 2001 4:26 AM
To: samba at lists.samba.org
Subject: (no subject)


Hello.
 
There is problem need your help.
 
Our company want to migrate from NT4.0 server to linux server, but I
have some problem need to be resolve, 
I download the dumppaswd program and get all smb account from the NT4.0
PDC. 
But I need also add Unix user have the same uid of smb users.
The number of account is about one hundred, so I want to 





More information about the samba mailing list