[Samba] Autocreate share when connect

markus klimklim at gmx.de
Mon Dec 11 11:08:51 GMT 2006

Rashid N. Achilov schrieb:
> What about feature autocreate share when first connect occured? When new user 
> added to domain and he/she first connecting to their home directory on 
> fileserver, it created automatically, sets owner and rights.

Try the option "root prexec" with something like "root preexec =
/root/bin/mkhome %u %g" and add it into your homes section. The script
could look like this:

if [ ! -d "/home/$1" ];
  mkdir /home/$1
  chmod 700 /home/$1
  chown -R $1:$2 /home/$1

  if [ $2 == "group1" ]; then
    setquota -u -F vfsv0 $1 20100000 22000000 0 0 /dev/sdb2
    setquota -u -F vfsv0 $1 5242880 5767168 0 0 /dev/sdb2

More information about the samba mailing list