Install Samba Server on Raspberry Pi - ajumalp/rpi-nas GitHub Wiki

  • To install Samba Server, run below command
sudo apt -y install samba samba-common-bin
  • Now create a folder which should be set as shared folder. For that run below command
mkdir /home/pi/shared
  • Next we need to provide full access to this folder.
  • Run below command and edit the smb configuration file to provide full access
sudo nano /etc/samba/smb.conf
  • Now you can see the file open in terminal.
  • Go to the end of that file and then paste below text
[Public SDCard]
Comment = Public Folder from SDCard
Path = /home/pi/shared
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0644
directory mask = 0755
force create mask = 0644
force directory mask = 0755
force user = root
force group = root
Public = yes
Guest ok = yes
read only = no
  • To save the file, press Ctrl+X
  • then press Y and then press Enter Key
  • Finally we need to create a user for Samba. Run below command
sudo smbpasswd -a pi
  • You will be prompted afterward to enter the password
  • Finally, before we connect to our Raspberry Pi Samba share, we need to restart the samba service so that it loads in our configuration changes
sudo systemctl restart smbd