[Samba] FDS + samba + add machine account script

Sadique Puthen sputhenp at redhat.com
Mon Feb 4 07:41:53 GMT 2008


satish patel wrote:
> Dear all 
>
>                I have setup FDS for samba backend but i dont know how to add machine account in FDS it is possible through script or manaualy...
>   

Better you add it through scripts. The GUI interface for FDS is not so 
sophisticated to add samba machines through simple clicks, you should 
have to have a lot of clicks.

I use a simple script as below.  This is used against an openldap 
server, but there is no reason for this not to work with FDS. Define a 
base id at /etc/samba/machineid before you start the script.

[root at dhcp6-232 ~]# cat addmachine.sh
#!/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 
dhcp6-120.pnq.redhat.com, please only enter dhcp6-120    : "  choice
/usr/bin/ldapmodify -a -x -H ldap://10.65.7.98 -D 
cn=admin,dc=samba,dc=redhat,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

Other choice is to use smbldap-tools scripts as you  may wish.

--Sadique

>
>
>
> $ cat ~/satish/url.txt                                                      
>
> http://www.linuxbug.org
> _____________________________________________________________________________________________________
>
>        
> ---------------------------------
>  Forgot the famous last words? Access your message archive online. Click here.
>   



More information about the samba mailing list