CIFS/SMB home share not creating user directories

Sycobob

Dabbler
Joined
Jul 23, 2018
Messages
19
I'm tearing my hair out with this one. After upgrading to 11.3-U3.1 I've been having issues with home shares. I've resorted to running FreeNAS in a VM to figure out what's wrong/how to set things up now.

The core issue seems to be that when a new user authenticates it's not creating a directory for their home share. Here's a snippet of log.smbd from one of my attempts.

Code:
[2020/06/02 22:12:08.397049,  1] ../../source3/printing/printer_list.c:234(printer_list_get_last_refresh)
  Failed to fetch record!
[2020/06/02 22:12:08.397091,  1] ../../source3/smbd/server_reload.c:64(delete_and_reload_printers)
  pcap cache not loaded
/mnt/pool/windowset/test: No such file or directory
[2020/06/02 22:12:08.461994,  0] ../../source3/modules/smb_libzfs.c:157(get_zhandle)
  get_zhandle: Failed to obtain zhandle on parent directory: (/mnt/pool/windowset/test)
[2020/06/02 22:12:08.462032,  0] ../../source3/modules/smb_libzfs.c:577(smb_zfs_path_get_props)
  smb_zfs_path_get_props: Failed to obtain zhandle on [/mnt/pool/windowset/test]: No such file or directory
[2020/06/02 22:12:08.462046,  0] ../../source3/modules/vfs_ixnas.c:2240(ixnas_connect)
  ixnas_connect: Failed to get ZFS properties for share
[2020/06/02 22:12:08.462060,  1] ../../source3/smbd/service.c:665(make_connection_snum)
  make_connection_snum: SMB_VFS_CONNECT for service 'test' at '/mnt/pool/windowset/test' failed: No such file or directory
/mnt/pool/windowset/test: No such file or directory


I can't find an up to date tutorial for home shares, but I'm fairly certain I'm doing things correctly.
  1. Create a pool
  2. Create a dataset (/mnt/pool/shares)
    1. Share type SMB
    2. Everything else default
  3. Create a user
    1. Everything default
    2. (new primary group, not a microsoft account, no home dir)
  4. Create an SMB share (/mnt/pool/shares)
    1. Use as home share
    2. Everything else default
  5. Edit SMB share ACL
    1. Default ACL options -> Home
But when I try to access the share from my Windows 10 machine I can't access the user folder. If I shell in and check the contents of /mnt/pool/shares it's empty. No home dir.
 
Joined
Jan 4, 2014
Messages
1,644
Try updating to U3.2 first
 

Sycobob

Dabbler
Joined
Jul 23, 2018
Messages
19
I noticed the update and tried that right after posting. Same result.

I've gotta be doing somethign wrong with permissions, I guess? Do I need to make other ACL changes? Do I need to assign an admin group to the SMB service?
 
Last edited:
Joined
Jan 4, 2014
Messages
1,644
Home directories are not the same as personal user shares. You may be confusing the two concepts. Home directories seem to have more application as a Unix concept. In the SMB world, they have limited application. Personal shares are much more useful. Try googling 'FreeNAS home directories' for clarification.
 

Sycobob

Dabbler
Joined
Jul 23, 2018
Messages
19
I'm not conflating unix user home dirs with samba home shares. I'm talking strictly about smb home shares. When a user authenticates it's supposed to create a share for that user.
 
Joined
Jan 4, 2014
Messages
1,644
Missing steps...
Step 4: Make sure Use as a home share is checked for the root share.
Step 3: Create Specify a home dir for the user under the root in the user account details.
 
Last edited:

Sycobob

Dabbler
Joined
Jul 23, 2018
Messages
19
Missing steps...
Step 4: Make sure Use as a home share is checked for the root share.
Not missing:
Create an SMB share (/mnt/pool/shares)
  1. Use as home share


Step 3: Create a home dir for the user under the root.
I have to manually create the share directory for each user? I thought that was created automatically?

From the documentation https://www.ixsystems.com/documentation/freenas/11.3-U3.2/sharing.html#windows-smb-shares
When the Use as home share option is selected, deselecting the Browsable to Network Clients option hides the share named homes so that only the dynamically generated share containing the authenticated user home directory will be visible.

ixnas:zfs_auto_homedir creates new ZFS datasets for users connecting to home shares instead of folders.

Am I misinterpreting?
 
Joined
Jan 4, 2014
Messages
1,644
I have to manually create the share directory for each user?
Yup. Once you specify a home dir in the account, you'll see two shares; one user share and a Homes share. You then hide the Homes share.
 
Last edited:
Joined
Jan 4, 2014
Messages
1,644
Correction: I meant specify the home dir within the root in the account details.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
This is a patched version of the vfs module in question. It should work on 11.3-U2.1 -> 11.3-U3.2. Steps to apply:
Code:
1) download file and extract zip
2) clone boot environment (for backup / path to revert)
3) replace /usr/local/lib/shared-modules/vfs/ixnas.so with the new version
4) restart samba "service samba_server onerestart"

This is not a requirement for home directories to work, but it is a requirement for the automatic ZFS dataset creation feature to work.
 

Attachments

  • ixnas.so.zip
    70.5 KB · Views: 233

Sycobob

Dabbler
Joined
Jul 23, 2018
Messages
19
This is not a requirement for home directories to work, but it is a requirement for the automatic ZFS dataset creation feature to work.

Does this apply to folders as well or only datasets? I'm not using `ixnas:zfs_auto_homedir`. It's not clear to me whether that is expected to auto-create a folder.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
Does this apply to folders as well or only datasets? I'm not using `ixnas:zfs_auto_homedir`. It's not clear to me whether that is expected to auto-create a folder.
pam_mkhomedir / Samba home directory combination requires that pw_dir for the user's passwd entry be the expanded path for the SMB share. E.g. if username = "bob" and SMB homes share path is "/mnt/tank/smbhome", then Bob's home directory _must_ be set to "/mnt/tank/smbhome/bob" before he connects to the share. This is auto-configured in AD environments, but requires manual setup for local users. I opened an improvement request for the webui to automatically populate the correct path for local users during account creation if SMB homes share is enabled.
 

Sycobob

Dabbler
Joined
Jul 23, 2018
Messages
19
Is the patched vfs module necessary for the folder case? I retried my steps in the original post but ensured I set the user folder to coincide with the smb home share and now I see this in log.smbd:

Code:
[2020/06/03 01:42:34.408491,  0] ../../source3/smbd/uid.c:448(change_to_user_internal)
  change_to_user_internal: chdir_current_service() failed!
 

Sycobob

Dabbler
Joined
Jul 23, 2018
Messages
19
1591236361019.png


1591236351706.png


1591236318831.png


1591236480400.png


EDIT: Ok, I think the missing step is applying HOME ACL template. I *think* it's working with that extra step
 
Last edited:

Sycobob

Dabbler
Joined
Jul 23, 2018
Messages
19
Ok, the last piece of the puzzle seems to be Microsoft accounts. I create an account and flag it as a Microsoft account. I also add path = /mnt/pool/users3/%u to ensure the Microsoft email maps to the correct home folder. I'm able to log in from Windows but when I attempt to open my user folder I get this:

1591238085905.png


And when I check log.smbd it looks like path = /mnt/pool/users3/%u isn't working and it's still attempting to open a folder based on my Microsoft email.

Code:
/mnt/pool/users3/myemail_gmail.com: No such file or directory
[2020/06/03 02:15:12.617823,  0] ../../source3/modules/smb_libzfs.c:157(get_zhandle)
  get_zhandle: Failed to obtain zhandle on parent directory: (/mnt/pool/users3/myemail_gmail.com)
[2020/06/03 02:15:12.617846,  0] ../../source3/modules/smb_libzfs.c:577(smb_zfs_path_get_props)
  smb_zfs_path_get_props: Failed to obtain zhandle on [/mnt/pool/users3/myemail_gmail.com]: No such file or directory
[2020/06/03 02:15:12.617865,  0] ../../source3/modules/vfs_ixnas.c:2240(ixnas_connect)
  ixnas_connect: Failed to get ZFS properties for share
[2020/06/03 02:15:12.617884,  1] ../../source3/smbd/service.c:665(make_connection_snum)
  make_connection_snum: SMB_VFS_CONNECT for service 'user' at '/mnt/pool/users3/myemail_gmail.com' failed: No such file or directory


Before upgrading I had this option working. Has something changed?

EDIT: Looks like the aux parameter has to be on the service not the share.
 
Last edited:
Top