FindPage
View Source:
KnowledgeBase/FreeBSD/SambaZfs
smb.conf: <code brush="plain"> [homes] ... root preexec = /users/.create_home.sh '%S' </code> _I lost the one that I was using. -- CyberLeo_ createhome.sh: <code brush="bash"> #!/bin/sh -e pebkac() { echo "Usage: $(basename "${0}") <username>" >&2 echo "" >&2 echo "Create the zfs home directories for the given user if they do not exist." >&2 exit 1 } fsbase="$(realpath "$(dirname "${0}")")" zpbase="$(mount | grep ' on '"${fsbase}"' ' | cut -d' ' -f1)" user="${1}" [ "${user}" ] || pebkac zpuser="${zpbase}/${user}" fsuser="${fsbase}/${user}" [ ! -e "${fsuser}" ] || exit 0 fspublic="${fsuser}/Public" fsprivate="${fsuser}/Private" fsdropbox="${fsuser}/DropBox" fsrecycle="${fsuser}/.recycle" zfs create "${zpuser}" mkdir -p "${fspublic}" chmod 755 "${fspublic}" mkdir -p "${fsprivate}" chmod 700 "${fsprivate}" mkdir -p "${fsdropbox}" chmod 1777 "${fsdropbox}" mkdir -p "${fsrecycle}" chmod 777 "${fsrecycle}" chown -R "${user}" "${fsuser}" </code>