Add Directories To OpenHAB Samba Server

You learn in this How To Add Directories to OpenHAB Samba Server how you easily add additional folders to the Samba Server. 

Add Directories To OpenHAB Samba Server

Add Directories To OpenHAB Samba Server

Index:

Background

I like to make it easy for you, hence I share with you what in this How To Add Directories To OpenHAB Samba Server was leveraged on:

  • A Raspberry Pi 4
  • OpenHAB openhabian installation

You like to consider, that In this how to we share a subfolder called “freqtrade” that sits in the openhabian user’s home directory. You however, could use any other folder in your home directory too. 

How To Add Directories To OpenHAB Samba Server

It is actually simple to add additional directories to the Samba server that is preinstalled on openhab. For you its however important to know where the configuration file is hanging and how you restart the Samba service. This How To will explain both to you. On top the how to shares with you  an example configuration that can be added to the configuration file.

Step 1 – Find Out Your Path That You Like To Add

You in the first step, like to find out the path of the directory you like to share. In the second step you like to add your preferred directory to the Samba server configuration. Best is you move on the command line into the directory that you like to add to the Samba server and execute the “pwd” command. In this case, we like to share the freqtrade directory.

openhabian@OpenHAB:~/freqtrade $ pwd
/home/openhabian/freqtrade

Now you know, that the to the Samba configuration to be added path is /home/openhabian/freqtrade, or whatever it is in your case.

Step 2 – You Update The Samba Configuration

Lets now update the Samba configuration which sits in a standard openhabian configuration in the following file: /etc/samba/smb.conf

vi /etc/samba/smb.conf

You now search within this confirmation file the section that is called “Custom Share Definitions”. You find some by OpenHAB preconfigured shares. These are the share you typically use to configure your OpenHAB. As you can imagine, adding the new directory is simple and rather a question of copy and paste then one of huge engineering. You now like to add the freqtrade directory (or whatever it is in your example):

[openHAB-freqtrade]
comment=openHAB Freqtrade Folder
path=/home/openhabian/freqtrade
writable=yes
public=no
create mask=0664
directory mask=0775
veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
delete veto files = yes

You of course replace the “path=/home/openhabian/freqtrade” path by which ever path you want to add to the Samba server. To be sure, you identified this path in the first step when you execute the “pwd” command.

Step 3 – You Restart The Samba Server

Now, there is one more thing you have to do. You need to restart the Samba server, because by restarting it you ensure the new directory will be shared. This, as everything in Linux, is very simple. You simply execute the below command, since it will restart the Samba server. If you restart the Samba server, then you are telling the Samba server to leverage on your updated configuration file.

sudo systemctl restart smbd.service

Additional Information

If you like to find more sophisticated information about the Samba server, and the options for Samba configurations, then you like to check out the Samba man pages

For the case you like to install OpenHAB on a Raspberry (or similar) device, which is very simple, then you like to read an easy how to. You like to check out the Setup A New OpenHAB how to!

You like to be aware, that this how to page is sharing many other how to’s with you. Simply click the home buttons or the categories to find out more.

I like your feedback! For this reason, I am very happy if you leverage on the contact form for your feedback!