# Samba scripts?



## gnoma (Jun 18, 2010)

Hi all, I am trying to make samba based domain controller for windoes clients 
I found this HOWTO: http://www.howtoforge.com/forums/showthread.php?t=24521 witch is great, but I even befor this after some google-ing I found out that I'll need samba scripts.
Well, I can't fid the location of this scripts, for addmachine, adduser and I am not sure for what else 
In this HOWTO sayes just...


> 3. Copy the 'smb-' scripts into the /usr/local/sbin/ directory, and mark them 'executable'. This can be done using 'chmod 555' on each of them.
> 4. Copy the 'samba_dns_update' script to /usr/local/sbin/, and mark it 'executable'.


Well there are given some scripts, but aren't in samba installation a default ready scripts I can use???
I spend 4 hours in google but couldn't find the location or names of the samba scrits on FreeBSD, or this 'samba_dns_update'
10x


----------



## varda (Jun 21, 2010)

You can use pw utility for account management and don't need external scripts.

```
add group script = /usr/sbin/pw group add "%g"
add machine script = /usr/sbin/pw user add "%u" -g machine -w no -d /nonexistent -s /sbin/nologin -c "PC Workstation"
add user script = /usr/sbin/pw user add "%u" -g user -w yes -s /usr/libexec/smrsh -m -c ""
add user to group script = /usr/sbin/pw group mod "%g" -m "%u"
delete group script = /usr/sbin/pw group del "%g"
delete user script = /usr/sbin/pw user del "%u" -r
delete user from group script = /usr/sbin/pw group mod "%g" -d "%u"
set primary group script = /usr/sbin/pw user mod "%u" -g "%g"
rename user script = /usr/sbin/pw user mod "%uold" -l "%unew"
```

But probably you'll need to create your own scripts for resource management.

```
add share command =
change share command =
delete share command =
add printer command =
delete printer command =
shutdown script =
abort shutdown script =
```


----------



## gnoma (Jun 23, 2010)

Okay this is great! I thing I figured out how it works  Thank you!

But now there's another problem... I still can not run normal domain controller on samba, the windows say "cannot locate the server copy of you roaming profile... bla bla bla" 
After logon I can resolv, browse, read and write the user's home directory. I don't know that's the problem. It can not find or it can not create it's home directory??? Becos it's like the first logno...
Here's the smc.conf and I thing everything is OK about the logon paths...

```
[global]
workgroup = DELTANEWS.LAN
realm = DELTANEWS.LAN
netbios name = DELTANEWS.LAN
server string = FreeBSDServer Domain Controller for DELTANEWS.LAN
hosts allow = 192.168.10. 192.168.40. 127.
#socket address = 192.168.1.1 127.0.0.1
security = user
admin users = b_popov
local master = yes
domain master = yes
preferred master = yes
domain logons = yes
wins support = yes
dns proxy = yes
os level = 33
msdfs root = yes
host msdfs = yes
obey pam restrictions = yes
time server = yes
lm announce = yes
lm interval = 120
passdb backend = tdbsam

; guest account = pcguest

; add user script = /usr/sbin/useradd %u
; add group script = /usr/sbin/groupadd %g
; add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null -s /bin/false %u
; delete user script = /usr/sbin/userdel %u
; delete user from group script = /usr/sbin/deluser %u %g
; delete group script = /usr/sbin/groupdel %g
add user script = /usr/local/sbin/smb-add-user %u
add group script = /usr/local/sbin/smb-add-group %g
add machine script = /usr/local/sbin/smb-add-machine %u
add user to group script = /usr/local/sbin/smb-add-user-group %u %g
delete user script = /usr/local/sbin/smb-rm-user %u
delete user from group script = /usr/local/sbin/smb-rm-user-group %u %g
delete group script = /usr/local/sbin/smb-rm-group %g
wins hook = /usr/local/sbin/samba_dns_update
log file = /var/log/samba/log.%m

# global file masks
directory mask = 0777
force directory mode = 0555
create mask = 0666
force create mode = 0444
# name resolution
name resolve order = wins bcast
load printers = yes
printcap name = cups
printing = cups

max log size = 50

; logon script = %U.bat

logon path = \\%L\Profiles\%U

socket options = TCP_NODELAY

#============================ Share Definitions ==============================

# netlogon directory, necessary for Domain Logons
[netlogon]
comment = Network Logon Service
path = /usr/local/lib/samba/netlogon
guest ok = yes
writable = yes
share modes = no


[Profiles]
path = /usr/local/lib/samba/profiles
browseable = yes
guest ok = yes
writable = yes
profile acls = yes
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = yes
writable = no
printable = yes
printer admin = @wheel


[print$]
comment = Printer Drivers
path = /usr/local/lib/samba/drivers
browseable = yes
guest ok = yes
writable = no
printable = no
```
and

```
#tail -f /var/log/messages
```
or

```
#tail -f /var/log/samba/*
```
The logs doesn't say anything during the logon.
Anybody have an idea? Thank you!


----------



## varda (Aug 8, 2010)

Hi there.

Share [profiles] points samba to location where to place profiles. This means that path you supplied:
	
	



```
path = /usr/local/lib/samba/profiles
```
 should contain directory hierarchy with proper ownership and permissions for all users which you want to log in to domain. Then samba will place profiles, i.e. USER.DAT and satellites, to that directories on per user basis. Example:
	
	



```
/usr/local/lib/samba/profiles/user1
/usr/local/lib/samba/profiles/user2
...
```


----------

