This article introduces how to install and configure Samba on Ubuntu16.04.
Also, we introduce how to mount the shared folder on Ubuntu and Windows.

1. Install and configure Samba

Installation

  • Samba needs to be installed only for the server:
    $ sudo apt-get install samba samba-common-bin
    

    Tip. We can check the status of the server with: $ sudo smbstatus.

  • For client, we need to install cifs-utils package:
    $ sudo apt-get install cifs-utils
    

Configuration (example)

  • Modify /etc/samba/smb.conf:
    [workspace]
    comment = workspace
    path = /home/junyonglee/workspace
    writable = yes
    browseable = yes
    valid users = junyonglee
    create mask = 0777
    directory mask = 0777
    

    Note: We are setting the mask with 0777, because we are sharing files not only in Windows but also in ubuntu.

  • Add Samba user:
    $ sudo smbpasswd -a ${USER}
    
    • Note:
      • The user name for Samba should be the same as user name of Ubuntu.
      • For each modification, Samba server needs to be restarted: $ sudo service smbd restart

2. Mounting

  • Ubuntu
    $ sudo mount -t cifs //DOMAIN OR IP/workspace ./ -o username=junyonglee,password=PASSWORD,uid=uid,gid=gid
    
  • Windows
    • Type \\DOMAIN OR IP on file browser.