SAMBA sharing on Raspberry Pi

Enabling SAMBA [smbserver] sharing makes life a lot easier, it enables us to create a simple share on the raspberry pi, in which can be mounted as a network drive.
This make transferring files into directories a lot easier, this is especially useful if you are not familiar with a Linux terminal and can be an efficient way to update and transfer files.

Installing Samba

Login to your rapsberry pi and execute the following commands

sudo apt-get update
sudo apt-get install samba
sudo nano /etc/samba/smb.conf

Copy and paste the below configuration, this will share the

“/home/homeassistant/.homeassistant”

path in which is the default location for HASSBIAN installs.

[global]
netbios name = RP2
server string = The Pi File Center
workgroup = WORKGROUP
hosts allow =
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
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 = yes
public = yes
create mask = 0777
directory mask = 0777
force user = root
force create mode = 0777
force directory mode = 0777
hosts allow =

Next we need to create a user for the SAMBA share, in this example we will be creating the user “pi”

sudo smbpasswd -a pi

Type a password of your choice and press enter.

Execute the following command, this will refresh the SAMBA service and you should be able to log in using the IP Address of your PI or hostname, I normally map mine as a network drive or access the share via run

\\[yourraspberrypiipaddress] or \\[yourraspberrypihostname]

sudo service smbd restart

I use my Raspberry pi to run many different software such as roomassistant, duckdns, lets encrypt,google assistant. These can be shared by locating the install directory on the raspberry pi and adding the below to the above configuration

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

Directory /home/p/i shared