Advertisement
Tritonio

Share your Raspberry Pi's files and folders across a network with samba

Mar 15th, 2021
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. You can share your Raspberry Pi's files and folders across a network using a piece of software called Samba, a Linux implementation of the Server Message Block protocol. You'll need to install this software:
  2. $ sudo apt-get install samba samba-common-bin
  3.  
  4. Samba contains the SMB protocol, support for the Windows naming service (WINS), and support for joining Windows workgroups. A workgroup is a group of computers on a local network that can access eachother's folders. Samba-common-bin contains a tool that you'll need to register users with Samba. Once these packages have finished installing, you need to edit the Samba configuration file:
  5. $ sudo leafpad /etc/samba/smb.conf &
  6.  
  7. Find the entries for workgroup and wins support, and set them up as follows:
  8. workgroup = your_workgroup_name
  9. wins support = yes
  10.  
  11. The name of the workgroup can be anything you want, as long as it only contains alphabetical characters, and it matches the name of the workgroup that you want to join.
  12.  
  13. You also need to add the following section of code to smb.conf:
  14.  
  15.  
  16. [pihome]
  17. comment= Pi Home
  18. path=/home/pi
  19. browseable=Yes
  20. writeable=Yes
  21. only guest=no
  22. create mask=0777
  23. directory mask=0777
  24. public=no
  25.  
  26. Scroll down smb.conf until you see a section called Share Definitions, and add this code there. The path should point to the drive or folder that you want to share. I've set 'only guest' and 'public' to 'no' so that Samba prompts for a password when I visit the folder that I've shared. This means that when I'm using a Windows PC, I can login to the shared folders on my Pi, and I'll have the same read/write permissions that user pi has.
  27.  
  28. Now type this command in a terminal, and enter pi's password twice:
  29. $ smbpasswd -a pi
  30.  
  31. If you have a PC or laptop connected to your workgroup, you should be able to see your Raspberry Pi in Windows Explorer under Network.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement