203 Setup SMB Quick and easy
Quick and easy = not secure!
First of all, what is SMB? SMB or Samba is the file-sharing protocol that Windows uses by default and is also supported by Macs.
Why do I need it? You only need to install Samba if you want to connect to your Pi from your Windows or Mac computer.
Update your Raspberry Pi OS.
sudo apt-get update sudo apt-get upgrade
Install Samba
sudo apt-get install samba samba-common-bin
Clean up your config file. This command will remove all the comments from the smb.conf file. (optional)
sudo sed -i -n '/^[^#]/ p' /etc/samba/smb.conf
Edit your config file
sudo nano /etc/samba/smb.conf
Because I am still in testing and behind my firewall, I am going to open up root for my user. Once this thing is out in the wild, that will change.
Here are the contents of my smb.conf file for reference.
[global] workgroup = WORKGROUP log file = /var/log/samba/log.%m max log size = 1000 logging = file panic action = /usr/share/samba/panic-action %d server role = standalone server obey pam restrictions = yes unix password sync = yes passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . pam password change = yes map to guest = bad user [root] comment = Home Directories browseable = yes read only = no create mask = 0777 directory mask = 0777 path = /
Once your config file is ready, it’s time to add your user. Replace USERNAME with the user name you want to use. You will also need to enter a password you wish to use for your SMB connection.
sudo smbpasswd -a USERNAME
Finally, restart the SMB service.
sudo systemctl restart smbd
To connect to your PI from your windows box, you will need to know the IP address of your Raspberry Pi. Once you know that, you can press the start button and type \\172.16.40.84 or your IP address. You will then be given a screen to enter your username and password. Enter .\USERNAME (replacing with your username from above) and the password you set. You should see the root folder now and can copy files to and from your Pi.