Saturday, December 31, 2016

Raspberry Pi Experiments - Setting Samba Network File Sharing



First of all Happy New Year to all. In this new post I will be focusing on how to convert  Raspberry Pi to a network file server.

For this I used the instructions from http://raspberrywebserver.com/serveradmin/share-your-raspberry-pis-files-and-folders-across-a-network.html and I am happy it worked.

In my previous post http://priyabgeek.blogspot.in/2016/12/raspberry-pi-experiments-file-server.html I had talked about attaching my Hard disk to raspberry pi and accessing files via a web server. While discussing this over Facebook I got a comment to use samba as a file server. Though I knew about it but was not sure how easy it is to set up.

So here are the steps I followed to setup samba in my Raspberry Pi 3.
1. Download the samba binaries
sudo apt-get install samba samba-common-bin
 In case you face issues please type sudo apt-get update and do the above step again for the installation to take place.

2. Take backup of /etc/samba/smb.conf
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bkp
3. Edit /etc/samba/smb.conf to make the necessary changes for network sharing
sudo vi /etc/samba/smb.conf
4. Please find the below options and make the necessary changes:

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
#   wins support = no

   wins support = yes
5. Also add the path that you want to share. In my case I wanted to share my mounted External hard drive. I added this part to the end of the file /etc/samba/smb.conf
[filedrive]
   comment= FileDrive
   path=/mnt/usbdrive
   browseable=Yes
   writeable=Yes
   only guest=no
   create mask=0777
   directory mask=0777
   public=no
 6. Mounting the hard disk
sudo mount /dev/sda1 /mnt/usbdrive/

7. Set up a samba password for pi user
sudo smbpasswd -a pi 
 8. Finally access the samba server from windows.

SambaServer 

Hope this short post is helpful to you  as it was to me.

1 comment:

  1. This is actually good to read content of this blog. A is very general and huge knowledgeable platform has been known by this blog. I in reality appreciate this blog to have such kind of educational knowledge.
    Cisco SF302 POE

    ReplyDelete

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...