[Samba] ldb*, -H, multiple source?
Rowland Penny
rpenny at samba.org
Tue Nov 14 16:53:36 UTC 2017
On Tue, 14 Nov 2017 17:31:15 +0100
Marco Gaiarin via samba <samba at lists.samba.org> wrote:
>
> There's some sintyax available to use, with ldb* tools, multiple
> ''server'', eg use multiple '-H', or write server in a roud-robin
> style?
>
> Thanks.
>
No, there is no way built into samba-tool to do what you are asking,
you will have to script something around samba-tool, something like
this:
#!/bin/bash
### Get DNS domain
DNSDOMAIN=$(hostname -d)
# Find DCs FQDN
DCS=$(host -t SRV "_ldap._tcp.${DNSDOMAIN}." | awk '{print $NF}')
# Exit if no DCs found
if [ -z "${DCS}" ]; then
echo "Could not find an AD DC."
exit 1
fi
# Use whichever DC is found first
DC=$(echo "$DCS" | head -n 1)
# This removes the trailing dot
DC="${DC::-1}"
echo "Use this DC: $DC"
exit 0
Rowland
More information about the samba
mailing list