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

Sadique Puthen sputhenp at redhat.com
Sat Feb 23 19:33:28 GMT 2008


Kyle Schmitt wrote:
> How does one go about adding a machine account, or even a normal samba
> account, on a Samba PDC with LDAP back end?
>
> I wanted to avoid using something like smbldap-useradd, because I want
> to actually understand what's going on.  I'm assuming it's just some
> sort of small ldif to add, like I would for adding user, am I wrong?
>   

I use the below script to add a machine account in ldap for samba.

#!/bin/bash
uid=`cat /etc/samba/machineid`
nextuid=$(($uid + 1))
echo $nextuid  > /etc/samba/machineid
read -p " Please enter the machine name (If your windows system name is 
, please only enter dhcp6-120    : "  choice
/usr/bin/ldapmodify -a -x -H ldap://<ip> -D 
cn=admin,dc=xxxx,dc=xxxxx,dc=com -w redsmb  << EOF
dn: uid=$choice\$,ou=Computers,dc=samba,dc=redhat,dc=com
uid: $choice\$
cn: $choice Account
objectClass: account
objectClass: posixAccount
objectClass: top
userPassword: {crypt}x
loginShell: /sbin/nologin
uidNumber: $uid
gidNumber: 2515
homeDirectory: /dev/null
EOF

After adding the machine account using the above script, I would be able 
to join the system to the PDC domain. The joining process would add 
additional required attributes and values appropriately while joining.

--Sadique

> Thanks,
>        Kyle
>   



More information about the samba mailing list