Project

General

Profile

Support #848

Setup Samba File Sharing on FreeBSD

Added by Daniel Curtis over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
File Server
Target version:
Start date:
08/31/2016
Due date:
% Done:

100%

Estimated time:
0.50 h
Spent time:

Description

This is a guide for setting up two samba shares on FreeBSD 10; one guest share that is visible by everyone, and another share that must be authenticated.

Prepare the Environment

  • Make sure the system is up to date:
    pkg update && pkg upgrade
    

Install Samba

  • Install samba4:
    pkg install samba43
    
  • Edit the samba config:
    vi /usr/local/etc/smb4.conf
    
    • And add/edit the following:
      [global]
      workgroup = WORKGROUP
      server string = Samba Server v %v
      netbios name = FileServer
      wins support = Yes
      security = user
      passdb backend = tdbsam
      
  • Start and enable samba and winbind at boot:
    echo 'samba_server_enable="YES"' >> /etc/rc.conf
    service samba_server start
    

Authenticated Share

  • Add the user bob:
    adduser
    
  • Add the samba user bob:
    smbpasswd -a bob
    
  • Make the /var/privatedownloads folder:
    mkdir /var/privatedownloads
    
  • Change the ownership of the privatedownloads folder:
    chown bob /var/privatedownloads
    
  • Edit the samba config:
    vi /usr/local/etc/smb4.conf
    
    • And add the following to the end of the file:
      # Share /var/privatedownloads accessible only to 'bob' user
      [privatedownloads]
      path = /var/privatedownloads
      valid users = bob
      writable  = yes
      browsable = yes
      read only = no
      guest ok = no
      public = no
      create mask = 0666
      directory mask = 0755
      
  • Restart samba:
    service samba_server restart
    

Read-Only Guest Share

  • Make the /var/downloads folder:
    mkdir /var/downloads
    
  • Change the ownership of the ownloads folder:
    chown bob /var/downloads
    
  • Edit the samba config:
    vi /usr/local/etc/smb4.conf
    
    • And add the following to the end of the file:
      # Share /var/downloads accessible to everyone as read-only
      [downloads]
      path = /var/downloads
      writable  = no
      browsable = yes
      read only = yes
      guest ok = yes
      public = yes
      directory mask = 0755
      
  • Restart samba:
    service samba_server restart
    

Resources

Also available in: Atom PDF