[Samba] Samba (3.6.12) - Different Home Directories for Different Users
Jim Potter
jimpotter at orange.net
Sun Mar 17 14:23:42 MDT 2013
Hi,
I have a similar setup (complex home directory setup) and I use the root
preexec option to do it. See the 'id $1 | grep staff' bit below to
check group membership.
I found that 'id auser' works much better than 'groups auser'. don't
know why, but groups sometimes takes a few moments to run, and the share
is not accessible until the script has finished.
Hope that helps,
Jim
From smb.conf:
[homes]
comment = windows home directory
path = /srv/nas/BEC/%U/home
root preexec = /bin/bash /srv/scripts/home.sh %U /srv/nas/BEC
read only = no
browseable = no
csc policy = documents
hide files = /desktop.ini/$RECYCLE.BIN/recycled/
veto files = /*.bat/
vfs objects = recycle
/srv/scripts/home.sh:
#!/bin/bash
if [ -z "$2" ]
then
echo "no repository specified"
exit 0
fi
if [ ! -d $2/$1 ]
then
mkdir -p $2/$1/home/AutoBackup
mkdir -p $2/$1/myDocs/Desktop
mkdir $2/$1/myDocs/Downloads
mkdir $2/$1/myDocs/My\ Music
mkdir $2/$1/myDocs/My\ Pictures
mkdir $2/$1/myDocs/My\ Videos
mkdir $2/$1/myDocs/OpenOffice\ backups
mkdir $2/$1/myDocs/OpenOffice\ templates
mkdir -p /srv/recycled/$1
ln -ns $2/$1/myDocs $2/$1/home/myDocs
ln -ns /srv/recycled/$1 /srv/users/$1/home/recycled
if (id $1 | grep "staff") >> /dev/null;
then
mkdir -p $2/$1/archive
ln -ns /srv/recycled/$1 $2/$1/archive/recycled
ln -s msdfs:personalTest\\archive $2/$1/archive
fi
chown -R $1:"Domain admins" $2/$1 /srv/recycled/$1
chmod -R 770 $2/$1 /srv/recycled/$1
chmod 570 $2/$1/home
fi
On 15/03/2013 20:59, TMason wrote:
> Hello,
>
> I am using Samba (3.6.12) with Gentoo Linux (Kernel Version 3.7.10)
> and I have a system integrated with Active Directory (the Microsoft
> Windows servers are running 2008 Enterprise Edition, Release 2). All
> is well on that front (I can log in, directories are created, etc.)
>
> What I would like to do now is have different /etc/skel directories
> for different groups. So, for example, if someone from the Finance
> department logs in one set of default settings are copied for that
> person but if someone from sales logs in another set of default
> settings are copied over for that user.
>
> How can I do this with Samba/Linux? Thank you for your time.
>
More information about the samba
mailing list