[Samba] Adding a machine account to Samba PCD + LDAP?

Sadique Puthen sputhenp at redhat.com
Tue Feb 26 19:10:12 GMT 2008


Kyle Schmitt wrote:
> It doesn't need sambaSamAccount as part of it's ldap entry?
>   

Yes, it need that objectClass. As I said, when you do "smbpasswd -a 
<username>", all those entries would get automatically added to ldap 
database.

--Sadique

> I thought it was needed.  Or is it only needed if there is no
> corresponding unix account?
>
> --Kyle
> On Tue, Feb 26, 2008 at 11:50 AM, Sadique Puthen <sputhenp at redhat.com> wrote:
>   
>> 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