LinuxMint 18: Install samba for file server

This article will describe installing samba and sharing files with Windows 10. IP address of samba machine is 192.168.11.66.

1 Install samba

Install samba with apt.

$ sudo apt install -y samba

2 pdbedit

Add user access to samba with pdbedit.

$ sudo pdbedit -a hiroom2
new password:
retype new password:

3 /etc/samba/smb.conf

This article show how to share home directory for each user and share directory with multiple user.

Please reboot smbd and nmbd after editing smb.conf.

$ sudo systemctl restart smbd nmbd

3.1 Share home directory for each user

Share home directory for each user added by pdbedit.

$ diff -uprN /etc/samba/smb.conf{.org,}
--- /etc/samba/smb.conf.org     2017-01-12 14:08:47.909344000 +0900
+++ /etc/samba/smb.conf 2017-01-12 14:14:25.065344000 +0900
@@ -190,13 +190,13 @@
 # Un-comment the following (and tweak the other settings below to suit)
 # to enable the default home directory shares. This will share each
 # user's home directory as \\server\username
-;[homes]
-;   comment = Home Directories
-;   browseable = no
+[homes]
+   comment = Home Directories
+   browseable = no

 # By default, the home directories are exported read-only. Change the
 # next parameter to 'no' if you want to be able to write to them.
-;   read only = yes
+   read only = no

 # File creation mask is set to 0700 for security reasons. If you want to
 # create files with group=rw permissions, set next parameter to 0775.
@@ -211,7 +211,7 @@
 # Un-comment the following parameter to make sure that only "username"
 # can connect to \\server\username
 # This might need tweaking when using external authentication schemes
-;   valid users = %S
+   valid users = %S

 # Un-comment the following and create the netlogon directory for Domain Logons
 # (you need to configure Samba to act as a domain controller too.)

3.2 Share directory with multiple user.

Share permission 0777 directory with multiple user adde by pdbedit.

$ diff -uprN /etc/samba/smb.conf{.org,}
--- /etc/samba/smb.conf.org     2016-05-10 09:38:31.909847328 +0900
+++ /etc/samba/smb.conf 2016-05-10 09:46:25.758629642 +0900
@@ -187,6 +187,14 @@

 #======================= Share Definitions =======================

+[share]
+   comment = Share directory
+   path = /var/lib/share
+   read only = no
+   guest only = no
+   guest ok = no
+   share modes = yes
+
 # Un-comment the following (and tweak the other settings below to
 # suit)
 # to enable the default home directory shares. This will share each
 # user's home directory as \\server\username

Change /var/lib/share's permission to 0777.

$ sudo mkdir /var/lib/share
$ sudo chmod 0777 /var/lib/share

4 Access to samba from Windows 10

Access to the following URL with explorer. Sharing home directory is \\192.168.11.66\hiroom2. Sharing directory with multiple user is \\192.168.11.66\share.