Search
Close this search box.

Cheat sheet: Install a Windows network share server (SMB/CIFS) on Ubuntu server 14.04

  1. Install samba
    sudo apt-get install samba
  2. Configure sharings.
    Save your samba configuration:

    mv /etc/samba/smb.conf /etc/samba/smb.conf.SAVE

    Put the folowing into a new /etc/samba/smb.conf file

    [global]
    
    ## Browsing/Identification ###
    workgroup = MYGROUP
    server string = Samba server (%h)
    netbios name = Serveur
    dns proxy = no
    
    #### Networking ####
    #interfaces = 192.168.0.15
    #bind interfaces only = yes
    
    ### Access rights ###
    create mask = 0660
    directory mask = 0770
    
    #### Debugging/Accounting ####
    log file = /var/log/samba/log.%m
    max log size = 1000
    syslog = 0
    panic action = /usr/share/samba/panic-action %d
    
    ####### Authentication #######
    security = user
    # ATTENTION A BIEN REMPLACER "groupe_principal" par le nom du groupe dont vous faites partie
    # (si vous êtes l'utilisateur principal, c'est également votre login)
    # et de rajouter les éventuels autres utilisateurs...
    #valid users = @guest, @smbgroup
    encrypt passwords = true
    passdb backend = tdbsam
    obey pam restrictions = yes
    unix password sync = no
    map to guest = bad user
    
    ############ Misc ############
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=8192 SO_SNDBUF=8192
    usershare allow guests = no
    
    ############ SHARING 1 ############
    [MOVIES]
    comment = Movies dir
    path = /mnt/movies
    browsable = yes
    guest ok = no
    read only = no
    create mask = 0755
    
    ############ SHARING 2 ############
    [DOCUMENTS]
    comment = Documents dir
    path = /mnt/documents
    browsable = yes
    guest ok = no
    read only = no
    create mask = 0755

    and modify
    – workgroup
    – server string
    – interface (put the IP of your NAS here if you want to restrict the samba listing interface)
    – the name of your sharings ([MOVIES], …) and the path inside them.

  3. Restart samba to make it take into account the configuration
    sudo restart smbd
    sudo restart nmbd
  4. Add users to access the shares (note that the default passdb backends require the user to already exist in the system password file (usually /etc/passwd), else the request to add the user will fail.)
    smbpasswd -a <username>
  5. You should be able to connect to your shared folders from a Windows/Linux computer using user <username>.
Share the Post:

Related Posts