Config:Samba4-script-homedrive
#!/usr/bin/env bash
TMP=$(echo $1 | grep -qE '_$')
if [ $_ eq 0 ]; then
exit 0
fi
if [ ! -d /export/homes/$1 ]; then
HDIR="/export/homes/${1}"
SUID=$(wbinfo --sid-to-uid $(wbinfo --name-to-sid $1 | awk '{print $1}'))
mkdir ${HDIR}
chown ${SUID} ${HDIR}
chmod 700 ${HDIR}
fi