Setting up Samba directory sharing kb-11

Octavo / Beaglebone Black  

In this article, we cover how to set up a network share that you can use from a Windows system. We do this primarily to move files back and forth and to facilitate remote development using Visual Studio from a Windows system. We will accomplish this by installing SAMBA, which will enable file sharing with other computers over the SMB protocol.


  1. Establish a working Debian system on an SD card or 8Gb or more, and expand the filesystem to make full use of the available space (see
  2. Establish a working network connection with access to the internet, either via the USB networking link, ethernet, or a wifi device.


  1. Install the Samba server package.  This will allow other systems to access your BeagleBone/OSD3358 filesystem
    debian@beaglebone:~$ sudo apt-get install samba
  2. If you will also want to mount Windows shares onto your BeagleBone/OSD3358 system, then you should also install the Samba client package:
    debian@beaglebone:~$ sudo apt-get install samba-client
  3. Set a password for the default user 'debian'  (change 'debian' if you have created and are using a different user for your development). Samba uses it's own password database. Users must first exist in /etc/passwd, and then you can add them to the samba system with smbpasswd -a:
    debian@beaglebone:~$ sudo smbpasswd -a debian
    New SMB password:
    Retype new SMB password:
    Added user debian.

  4. Edit /etc/samba/smb.conf using 
    debian@beaglebone:~$ sudo nano /etc/samba/smb.conf
    1. Normally, access to your home directory will be read-only, but we want to be able to write to the home directory. So change read only = yes to read only = no

         comment = Home Directories
         browseable = no

      # By default, the home directories are exported read-only. Change the
      # next parameter to 'no' if you want to be able to write to them.
         read only = no

    2. You can add more shares to other directories by adding sections like the one shown below.  Best to get the basics working first, but you can come back later and add more shares like this:
         comment = Some useful files
         read only = no
         locking = no
         path = /path_to_the_files
         guest ok = no

    3. Comment out the section on 'printers' by placing a semi-colon at the start of each line.  When complete, it will look something like this:
      ;   comment = All Printers
      ;   browseable = no
      ;   path = /var/spool/samba
      ;   printable = yes
      ;   guest ok = no
      ;   read only = yes
      ;   create mask = 0700

    4. Also comment out this section:
      ;   comment = Printer Drivers
      ;   path = /var/lib/samba/printers
      ;   browseable = yes
      ;   read only = yes
      ;   guest ok = no

    5. Save the file with Ctrl-o and Ctrl-x.
  5. Restart the samba server:
    debian@beaglebone:~$ sudo /usr/sbin/service smbd restart
  6. From a windows system, try to mount the newly created share:

    C:\>net use * \\beaglebone\debian /u:debian *
    Type the password for \\beaglebone\debian:
    Drive Z: is now connected to \\beaglebone\debian.

    The command completed successfully.

  7. If the 'beaglebone' hostname does not resolve, you can also perform the 'net use' with an ip address.  If you are using a USB connection to the standard BeagleBone Linux distribution, then you can use If you are using wifi or ethernet, then use the Linux 'ifconfig' command to learn the ip address, or consult your wifi router to find out what address was assigned to your board.  The following is an example of the same command as the previous step, but with an IP address.

    C:\>net use * \\\debian /u:debian *
    Type the password for \\\debian:
    Drive Z: is now connected to \\\debian.

    The command completed successfully.

  8. You can also specify which drive letter to use for the mount (this is helpful when you want the board to always mount on the same drive letter) :
    C:\>net use Q: \\\debian /u:debian *
    Type the password for \\\debian:
    The command completed successfully.


  9. Once the drive is mounted, you can treat it like any windows drive:
    C:\>dir q:
     Volume in drive Q is debian
     Volume Serial Number is D93F-FD0E

     Directory of Q:\

    10/09/2016  02:55 PM    

    05/13/2016  11:08 AM    
    09/21/2016  01:15 PM    
    05/13/2016  11:08 AM    
    09/23/2016  07:20 AM               832 BB-DCAN1-00A0.dtbo
    09/23/2016  07:16 AM               810 BB-DCAN1-00A0.dts
                   2 File(s)          1,642 bytes
                   4 Dir(s)  26,601,553,920 bytes free


  10. To remove a mounted drive from the Windows system, use this command:
    C:\>net use q: /d
    q: was deleted successfully.


  11. Note that Windows will try to re-mount your drive each time you log in, which can be useful if you are using that mount for development on a BeagleBone Black or GHI OSD3358 development board.



comments powered by Disqus