#!/bin/sh
#
# smb-useradd
#
# This script is invoked through "add user script" parameter by SWAT,
# like:
#   [global]
#   add user script = /usr/local/samba/bin/smb-useradd %u
# And create a new user and its home directory.
#
SMB_USER_HOMEDIR=/var/samba/home
SMB_GROUP=smb

useradd -s /bin/false -d ${SMB_USER_HOMEDIR}/$1 $1
mkdir -p ${SMB_USER_HOMEDIR}/$1
#mkdir -p ${SMB_USER_HOMEDIR}/$1/public_html
chown -R $1 ${SMB_USER_HOMEDIR}/$1
#chgrp -R ${SMB_GROUP} ${SMB_USER_HOMEDIR}/$1

