How to use Active Directory's homeDirectory attribute for Samba?

11,727

The answer was actually in the Samba wiki, but I skipped over it since it was for Windows 2003 and I'm using Windows 2008 R2.

Anyways, you have to install the Active Directory Unix attributes where you can set the homeDirectory and the Linux / Unix attributes.

After that, simply add this line to /etc/samba/smb.conf:

winbind nss info = rfc2307

This will use the AD's UID/GID as well as the homeDirectory :)

Share:
11,727

Related videos on Youtube

Shiroi98
Author by

Shiroi98

PHP / MySQL Programmer

Updated on September 18, 2022

Comments

  • Shiroi98
    Shiroi98 over 1 year

    I currently have a Samba share setup where I would like to share Unix folders with Windows users, with Active directory as the backend. I see that there is an attribute called homeDirectory in Active Directory, but no matter what I set, Samba refuses to use that attribute (verified by doing "getent passwd")

    Additionally, I tried the

    template homedir = /home/%u
    

    in /etc/samba/smb.conf, but the problem is, some users have /home_abc/[username] while others have /home_def/[username]. That sets ALL users to /home/[username]. If I don't use the template homedir, by default it is set to /home/[DOMAIN]/[username].

    Bottomline: How can I use Active directory's homeDirectory attribute to set users Home Directory in Unix/Samba?

    Any help greatly appreciated! :)

    EDIT 12/17: I have tried using the %H variable as listed on : http://www.samba.org/samba/docs/using_samba/ch06.html but when I do, all my users home directory shows up as %H instead of the correct home directory (/home_us/username or /home_tw/username)

    • Zoredache
      Zoredache over 11 years
      Why have you split up your home folder into separate directories? Can you simply merge them together and make your life easier?
    • Shiroi98
      Shiroi98 over 11 years
      I would but it was setup before I joined the company. The two folders are setup because they are for two different countries. Folder A for country A employees, folder B for country B employees
    • Michael Hampton
      Michael Hampton over 11 years
      A couple of symlinks will fix that.
    • Shiroi98
      Shiroi98 over 11 years
      @Michael, Could you please elaborate on how will that work? I'm a little new to Linux systems. Thansk