Samba einrichten für Home Assistant

      Kommentare deaktiviert für Samba einrichten für Home Assistant

To install Samba, enter the command, sudo apt-get install samba samba-common-bin. Now, we need to configure the Samba configuration file so enter the following command, sudo nano /etc/samba/smb.conf .

The Samba configuration file it is well documented. You can go through it and enable the options you would like. You can also remove everything by pressing and holding Ctrl+K and pasting the following configuration:

Mit Shift+Insert kann man die Konfiguration im Nano einfügen

[global]
netbios name = SmartHomeServer
server string = The SmartHome File Center
workgroup = WORKGROUP
hosts allow =
remote announce =
remote browse sync =

[HOME ASSISTANT]
path = /home/homeassistant/.homeassistant
comment = No comment
browsable = yes
read only = no
valid users =
writable = yes
guest ok = no
public = yes
create mask = 0777
directory mask = 0777
force user = root
force create mode = 0777
force directory mode = 0777
hosts allow =

[HOME ASSISTANT ESPHOME]
path = /home/pi/esphome
comment = No comment
browsable = yes
read only = no
valid users =
writable = yes
guest ok = no
public = yes
create mask = 0777
directory mask = 0777
force user = root
force create mode = 0777
force directory mode = 0777
hosts allow =

Here is a short explanation of what the code above means:

  • workgroup: This is the domain that the Samba server will be part of. By default, Windows has the workgroup set as WORKGROUP
  • path: The path for the Home Assistant configuration files
  • writeable: If set to yes, it will allow the folder to be writeable
  • create mask and directory mask: When set to 0777 allows the user to read, write and execute
  • public: If set to no, it will only allow valid users to access the shared folder

Press Ctrl+X to exit and then press Y to save the changes. Next, you need to set up a Samba password. Enter the following command, sudo smbpasswd -a pi. Enter a new password when prompted. You can use the same password as your Raspberry Pi user but for security, enter a different password.

Last but not least, restart the Samba service to apply all changes using the command, sudo service smbd restart.

To access the Samba shared folder on a windows computer, open Windows File Explorer and click on Network. The Raspberry Pi shared folder will now be displayed. Click on it and enter your Pi’s username and the Samba password. After that, you can access the Home assistant configuration.yaml file and quickly make any changes.