#!/usr/local/bin/perl -Tw
#
use File::Temp qw/ tempfile /;
#...
...Some code....
#
#
# create a temp file and write the users new password into it, file is automtically deleted.
my $password = $_; my ($fh, $filename) = tempfile(UNLINK => 1);
print $fh $password;
# Run mkntpasswd reading the password from file, this is the secure way i think...
my $winpass = `/usr/sbin/mkntpwd -f $filename`;
#The output is 2 passwords joined by a ":", split them into 2 varibles
my ($LANpass, $NTpass) = split /:/, $winpass;
#########################################
So you have the Lan Man password in $LANpass and Your NT Password in $NTpass.
Update LDAP with the values from the variables.
hope this helps
Patrick DUBAU wrote:
Hi,
i plan to mass creat user in ldap to use with samba
I tried with ldiff like the structure below, the user is created but no home directory is created, user in not member on any groups.
1) how to do with ldiff file to put a user member of a group ?
So i plan to use smbldap-useradd => home drectorie is created with the appropriated rights, user is member of "Domain Users" : Great !
My goal is to creat a script that will, for each user in a text file, call smbldap-useradd. I think that this won't be too difficult (any hint will be apreciated)
My problem is that i also want to generate a password with smbldap-passwd. But this script doesn't accept any parameters. It prompts for a password ...
2) Is there a solution to avoid this problem so that i also can generate mass user password ?
Thanks
Here's my ldiff : dn:uid=pat.dub,ou=People,dc=samba,dc=alsace,dc=iufm,dc=fr changetype: add objectClass: top objectClass: inetOrgPerson objectClass: posixAccount objectClass: shadowAccount objectClass: sambaSAMAccount cn: Pat Dub sn: pat.dub uid: pat.dub uidNumber: 1001 gidNumber: 513 homeDirectory: /home/admin/strasbourg/pat.dub loginShell: /bin/false gecos: Pat DUB description: Pat DUB sambaPwdLastSet: 1106131176 sambaLogonTime: 0 sambaLogoffTime: 2147483647 sambaKickoffTime: 2147483647 sambaPwdCanChange: 0 sambaPwdMustChange: 2052116073 displayName: Pat DUB sambaAcctFlags: [UX] sambaSID: S-1-5-21-3283536956-439905991-814256716-5000 sambaPrimaryGroupSID: S-1-5-21-3283536956-439905991-814256716-513 sambaNTPassword: 9ABB609276FF0C69184CC4766A8ED206 sambaLogonScript: logon.bat userPassword: {SSHA}bgyoqB7fFClEfmqdPaZnIZh/41t6xJO3 sambaHomeDrive: p:
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Daniel Wilson Systems Administrator
IT & Communications Service University of Sunderland Unit1 Technology Park Chester Road Sunderland SR2 7PT
Tel: 0191 515 2695
This e-mail contains information which is confidential and may be privileged and is for the exclusive use of the recipient. It is the responsibility of the recipient to ensure that this message and its attachments are virus free. Any views or opinions presented are solely those of the author and do not necessarily represent those of the University, unless otherwise specifically
stated.
-- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
