SMB setup
Network Sharing
openHAB depends on configuration files and folders with custom content (details in Configuration articles). Because your openHAB installation most probably is stored on a remote device, being able to easily access and modify these files from your local PC or Mac is important. Therefore setting up a Samba network share is highly recommended.
The openHAB VS Code Extension software does also depend on a mounted share to access the openHAB configuration files.
We will now guide you through the Samba network shares setup process. Start by installing Samba. Afterwards open it's configuration file in your favorite editor:
sudo apt-get install samba samba-common-bin
sudo vim /etc/samba/smb.conf
Change the workgroup name if needed, otherwise uncomment and enable WINS support:
wins support = yes
Next, add the desired share configurations to the end of the file:
-
Package repository based installation:
[openHAB2-userdata] comment=openHAB2 userdata path=/var/lib/openhab2 browseable=Yes writeable=Yes only guest=no public=no create mask=0777 directory mask=0777 [openHAB2-conf] comment=openHAB2 site configuration path=/etc/openhab2 browseable=Yes writeable=Yes only guest=no public=no create mask=0777 directory mask=0777 -
Manual installation:
[openHAB-files] comment=openHAB2 path=/opt/openhab2 browseable=Yes writeable=Yes only guest=no public=no create mask=0777 directory mask=0777
Save and close the samba configuration file.
sudo smbpasswd -a openhab
Be aware, that creating and later using a specific user will ensure, that permissions are honored. Make sure, the "openhab" user has ownership and/or write access to the openHAB configuration files. This can be accomplished by executing:
sudo chown -hR openhab:openhab /etc/openhab2 /opt/openhab2/conf
Finally check the configuration file for correctness and restart Samba to load the new settings:
testparm
# Linux init systems based on sysVinit
sudo service smbd restart
# Linux init systems based on systemd
sudo systemctl restart smbd.service
Mounting Locally
After setting up and restarting Samba, check your connection to the shared folder and create a permanent mount. Check the network devices manager of your local operating system to find and access your openHAB host and share. These might however not be auto-discovered. You can also manually connect:
-
On macOS: Open Finder → Go → Connect to Server:
smb://[email protected] -
On Windows: Open Windows Explorer → Address bar:
\\openhab-device.local→ Right click a share and assign a drive letter
Be sure to use the actual host name instead of openhab-device. When asked, authenticate with the username "openhab" and the chosen password. If you are not able to connect, try with the IP of your device (e.g. smb://[email protected] or \\192.168.0.2).
If everything went well, you are set and ready to start configuring your openHAB system.
No Comments