[Samba] Adding a machine account to Samba PCD + LDAP?
Sadique Puthen
sputhenp at redhat.com
Tue Feb 26 17:50:48 GMT 2008
Kyle Schmitt wrote:
> Sadique,
> Thanks. That got me where I need I think. Now, to pester
> further, how does one determine a users sid if one were to manually
> generate an ldif to add samba users to ldap?
>
I use the below script to add a samba user to ldap database.
#!/bin/bash
uid=`cat /etc/samba/userid`
nextuid=$(($uid + 1))
echo $nextuid > /etc/samba/userid
read -p " Please enter the user name : " choice
/usr/bin/ldapmodify -a -x -H ldap://<ip> -D
cn=admin,dc=samba,dc=example,dc=com -w redsmb << EOF
dn: uid=$choice,ou=People,dc=samba,dc=example,dc=com
uid: $choice
cn: $choice Account
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}!!
shadowLastChange: 13904
shadowMax: 99999
shadowWarning: 7
loginShell: /sbin/nologin
uidNumber: $uid
gidNumber: 2515
homeDirectory: /dev/null
EOF
smbpasswd -a $choice
See the last "smbpasswd -a $choice" command. You don't have to worry
about the sids for users. smbpasswd command would pick the next
available sid and add that as an attribute for that user.
--Sadique
> In the meanwhile I'm digging through the docs, but to little avail.
>
> Thanks,
> Kyle
>
More information about the samba
mailing list