samba at nisx.de
2013-Apr-29 18:28 UTC
[Samba] samba4: get sysvol from windows domain controller
Hi,
?
I've read the question how to get the sysvol folder from windows server.
Can't find the thread anymore.
?
Here is my solution:
?
Put Administrator password to '${PREFIX}/etc/passwd.cfg' and set it to
root.root and 0600.
Put the name of the Windows domain controller to ,${PREFIX}/etc/master.cfg'
?
==============================================================================
#!/bin/bash
#
(
? PREFIX="/opt/samba"
? DOMAIN="$(${PREFIX}/bin/samba-tool domain info 127.0.0.1
2>/dev/null|grep -i "Netbios domain")"
? DOMAIN="${DOMAIN##*: }"
?
? USR="Administrator"
? PASS="$(cat ${PREFIX}/etc/passwd.cfg)"
? SRV="$(cat ${PREFIX}/etc/master.cfg)"
?
? if [ "${DOMAIN}" = "" ] ; then
??? /usr/bin/logger -i -t nisx "samba get sysvol error: DOMAIN not
set!"
??? exit 10
? fi
? if [ "${PASS}" = "" ] ; then
??? /usr/bin/logger -i -t nisx "samba get sysvol error: PASSWORD not set!
Check '${PREFIX}/etc/passwd.cfg'"
??? exit 10
? fi
? if [ "${SRV}" = "" ] ; then
??? /usr/bin/logger -i -t nisx "samba get sysvol error: MASTER SERVER not
set! Check '${PREFIX}/etc/master.cfg'"
??? exit 10
? fi
?
? cd "${PREFIX}/var/locks/sysvol"
? rm -rf *
? "${PREFIX}/bin/smbclient" --user=${USR}%${PASS}
--workgroup=${DOMAIN} //${SRV}/sysvol "" -c "prompt off ; recurse
; mget *"
? cd
? "${PREFIX}/bin/samba-tool" ntacl sysvolreset
? /usr/bin/logger -i -t nisx "samba get sysvol from
\\\\${DOMAIN}\\${SRV}"
?
) 2>&1 >/dev/null
==============================================================================
Now this script can be run via cron outsite the main working time.
Mit freundlichen Gr??en
? Thomas Nolte
--
Nolte Infosysteme,? Im Sikfeld 8, 38304 Wolfenbuettel
Tel 05331-946210, Fax 05331-946211, Handy 0170-5508198
Computer, Netzwerk, Kommunikation www.nisx.de
?
