How to configure Samba on Ubuntu

1 minute read

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


Samba only needs to be installed for the server:

$ sudo apt-get install samba samba-common-bin

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:

  comment = workspace
  path = /home/junyonglee/workspace
  writable = yes
  browseable = yes
  valid users = junyonglee
  create mask = 0777
  directory mask = 0777

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}


  • 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


$ sudo mount -t cifs //[DOMAIN OR IP]/workspace ./ -o username=junyonglee,password=[PASSWORD],uid=uid,gid=gid


Type \\[DOMAIN OR IP] on file browser.