[Ubuntu] How to Configure Samba on Ubuntu16.04

less than 1 minute read

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

1. Install and configure samba

Installation

Samba only need to be installed for the server:

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

Note
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 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.


Leave a Comment