[Samba] how to automatically create user homedir

Tony Earnshaw tonye at billy.demon.nl
Tue Apr 5 13:42:34 GMT 2005


tir, 05.04.2005 kl. 13.12 skrev Luís Miguel Silva:

> Im using samba 3.0.11 and openldap.
> I need a way to auto create my users home when they connect to their HOME share.
> 
> How can i do that?!
> 
> PS: i tried the preexec directive but it didnt work! :o|

Well, it works for me ;)

I stole this from something a poster to this list wrote. Since I have
1150+ potential users it's very necessary

All on one line, /etc/samba.conf, for [homes]:

root preexec = /etc/samba/scripts/mk_sambadir "/m/samba3/home/%u" "%u"
"%g"

/etc/samba/scripts/mk_sambadir:

#!/bin/bash
if [ ! -d "$1" ]
then
  mkdir "$1"
fi
  chmod 770 "$1" -R
  chown "$2" "$1" -R
  chgrp "$3" "$1" -R

I use something similar to create profile dirs - on the fly, but there
are many other ways tof skin the same cat! 

--Tonni

-- 
Nothing sucksseeds like a pigeon without a beak ...

mail: tonye at billy.demon.nl
http://www.billy.demon.nl
 
They love us, don't they, They feed us, won't they ...



More information about the samba mailing list