[Samba] Samba 4.1.7 + CentOS 6.5 - Home's directory mounting in W7 + Roaming of Profils

Rowland Penny rowlandpenny at googlemail.com
Thu Jun 5 06:13:01 MDT 2014


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:
>
> [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
>
> [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
>
>
> [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
>
> ----------------------------------------------
> 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


More information about the samba mailing list