[Samba] Samba 4.1.7 + CentOS 6.5 - Home's directory mounting in W7 + Roaming of Profils
Rowland Penny
rowlandpenny at googlemail.com
Mon Jun 9 10:11:01 MDT 2014
On 09/06/14 16:24, Pascal Blétard wrote:
> > --------------------------------
> > From: Rowland Penny
> > Sent: Thursday, June 05, 2014 2:13 PM
> > To: samba at lists.samba.org
> > Subject: Re: [Samba] Samba 4.1.7 + CentOS 6.5 - Home's directory
> mounting in W7 + Roaming of Profils
> >
> > On 05/06/14 12:02, Pascal Blétard wrote:
> >> Hello all,
> >>
> >> I progress slowly in my installation of Samba; but I'm confronted
> to two problems:
> >>
> >> 1) Is it possible to configure Samba (4.1.7) directly from
> GNU/Linux (CentOS 6.5) for
> >> automatically mount the user's home directory to "H:" when he
> connects to the domain ?
> >>
> >> 2) In addition, after that, I'll try to set up profiles' roaming.
> >>
> >>
> >> Here's my files:
> >>
> >> ----------------------------------------------
> >> smb.conf (simplified after many tests)
> >> ----------------------------------------------
> >>
> >> # Global parameters
> >> [global]
> >> #general naming
> >> workgroup = ADS
> >> realm = ADS.LOCAL
> >> netbios name = SERVER
> >> server string = File Server
> >>
> >> #logging
> >> log file = /usr/local/samba/var/log/%m.log
> >> max log size = 50
> >> log level = 8
> >>
> >> server role = active directory domain controller
> >> dns forwarder = 172.16.130.7
> >> idmap_ldb:use rfc2307 = yes
> >>
> >>
> >> # These (uncommented) lines changes nothing
> >> # add user script =
> /usr/local/samba/sbin/add-user-script.sh %D %U %L
> >> #logon script = logon.bat
> >> #logon path = \\%L\\profile\\%U
> >> #logon drive = H:
> >>
OK, You do not need, in fact, shouldn't use the above 5 lines, they are
for a PDC, you have an AD DC.
> >> [netlogon]
> >>
> >> # this line isn't
> >> root preexec = /bin/bash
> /usr/local/samba/sbin/create-profile-directory.sh %D %U %L
> >> path = /usr/local/samba/var/locks/sysvol/ads.local/scripts
> >> read only = No
> >> #browsable=yes is for test only
> >> browsable=yes
> >>
Netlogon should just be:
[netlogon]
path = /usr/local/samba/var/locks/sysvol/ads.local/scripts
read only = No
> >> [sysvol]
> >> path = /usr/local/samba/var/locks/sysvol
> >> read only = No
> >> browsable=No
> >>
> >> [profile]
> >> comment = Roaming profiles
> >> path = /home/%D/profiles/
> >> #browsable=yes is for test only
> >> browsable = yes
> >> writable = yes
> >>
Remove the 'browseable' lines, there is no network browsing on a samba
AD domain.
> >>
> >> [homes]
> >> comment = %S's home
> >> root preexec = /bin/bash
> /usr/local/samba/sbin/create-home-directory.sh %D %S
> >> path = /home/%D/files/%S
> >> browsable = no
> >>
I take it that you want your windows users to have an home directory on
the samba 4 server, this can easily be done by adding 'session
required pam_mkhomedir.so skel=/etc/skel umask=0022' to
/etc/pam.d/common-session (This is on Debian) there is a similar thing
on Centos, I believe that it is called 'oddjob', try an internet search.
Also it should be [home], see the wiki
> >> ----------------------------------------------
> >> create-home-directory.sh :
> >> ----------------------------------------------
> >>
> >> #!/bin/bash
> >>
> >> if [ ! -e /home/$1/files/$2 ]; then
> >> mkdir -p /home/$1/files/$2
> >>
> >> chmod 775 /home/$1/files/$2
> >> chown $2:"Domain Users" /home/$1/files/$2
> >> fi
> >>
> >> exit 0
> >>
> >> ----------------------------------------------
> >> create-profile-directory.sh :
> >> ----------------------------------------------
> >>
> >> #!/bin/bash
> >>
> >> if [ ! -e /home/$1/profiles/$2 ]; then
> >> mkdir -p /home/$1/profiles/$2
> >>
> >> chmod 775 /home/$1/profiles/$2
> >> chown $2:"Domain Users" /home/$1/profiles/$2
> >> pdbedit -u $2 -D "H:" -S "\\$3\\netlogon\\logon.bat" -h
> "$3\\$2
> >> fi
> >>
> >> exit 0
> >>
> >> ----------------------------------------------
> >> add-user-script.sh:
> >> ----------------------------------------------
> >>
> >> #!/bin/bash
> >>
> >> /usr/sbin/useradd -s /bin/false -d /home/$1/files/$2 -m $2
> >> pdbedit -u $2 -D "H:" -S "\\$3\\netlogon\\logon.bat" -h "$3\\$2
> >>
> >> ----------------------------------------------
> >> logon.bat:
> >> ----------------------------------------------
> >>
> >> net use h: %LOGONSERVER%\%USERNAME%
> >>
> >> -----------------------------------------------
> >>
> >>
> >> Regards.
> >>
> >> Pascal Blétard
> >>
> >>
> > OK, remove just about everything that you have added to your smb.conf
> > and then go and spend some time reading the samba wiki, you are doing
> > everything wrong!
> >
> > Rowland
>
> Can you just explain me what am I doing wrong?
> Only "profil's roaming" and "the auto mounting of the home directory
> in W7" doesn't work...
>
As to automounting home dirs, not sure about this as I do not do it, but
I know Steve does, so hopefully he will chime in ;-)
I cannot stress strongly enough, that you should read the samba wiki,
most, if not all of the info you require is on there, if it isn't, say
what is missing or incorrect and I am sure Marc will be along to put it
right ;-)
Finally, please do not contact me direct unless I ask you to, please
keep it on list.
Rowland
More information about the samba
mailing list