Skip to content

smb_share

Troy Prelog edited this page Feb 9, 2021 · 5 revisions

Adding a Samba Share

SMB shares can be connected to any major operating systems including Windows, MacOS, and Linux.

SMB (also known as CIFS) is the native file sharing system in Windows. SMB shares will appear by default in the Navigation Pane of Windows File Explorer.

You should have already moved your configuration to an external dataset. I strongly encourage the use of an external dataset. On this page, we are going to create the SMB share to the external dataset. With this configuration you will retain SMB access to the configuration even when the jail is destroyed!

Create the share

Create the SMB with the Purpose set to No Presets as shown below. You should select or deselect all the check boxes so they match what is shown in the screen shot (including Export Read Only). We are going to use the auxiliary parameters to allow write access to the share for member of the homeassistant group you should have created on TrueNAS.

auxiliary parameters

The write list parameter overrides other Samba permissions to grant write access, Here, I am specifying a Unix group name by prefixing it with an at sign (@homeassistant).

The create mask and directory mask are used to help define the permissions that will be assigned to a file or directory at the time it is created. Setting these will ensure that new files and folder are created with the correct permissions for this setup.

# Users in this group will have write access
write list = @homeassistant

# Needed when using a cifs mount in Linux
force user = homeassistant

# New_Files are created with RW- RW- R--
create mask = 0664

# New_Folders are created with RWX RWX R-X
directory mask = 0775

ℹ️ You can set the umask used by the Home Assistant Core service using sysrc. During the plugin's installation, I have set the service to run with umask=002. This means any files or folders created by Home Assistant, will have permission set to correspond with the auxiliary parameters I have suggested above.

After creating or editing the SMB share, you will be asked if you want to configure ACLs.

For this basic approach, we do need to configure ACL permissions.

Always press CANCEL when asked to configure ACLs for this share.

TrueNAS Docs: Configuring a Windows SMB Share

About using ACLs

While easy to configure (and seems to work), I do not know if setting ACLs will have any hidden side effects to the services inside the jail, which must also access these files. Since ACLs are not required for the basic approach suggested on this page, I will error on the side of caution and suggest not using ACLs at this time. I assume if you must have ACLs configured for this share, you already know how to proceed.

TrueNAS Docs: Managing Access Control List

Setup user with RW access

option 1 (recommended)

Add to your own existing user account that is used for accessing SMB shares to the homeassistant group you should have created on TrueNAS. Any user that is added to this group on TrueNAS will have RW access this SMB Share.

TrueNAS Docs: Managing Groups

option 2

Change Disable Password to No and check the box to enable Samba Authentication for the homeassistant user you should have created on TrueNAS. Make sure to set a password after you enable login! You will need to connect as this user with the password you are setting here, when you need RW access to this SMB share.

TrueNAS Docs: Managing Users