ArchLinux 2016.06.01: Install Samba and share with Windows 10

This article describe how to install samba and access to samba server from Windows 10.

 

1 Install samba

Install samba with pacman.

$ sudo pacman -S --noconfirm samba
$ sudo cp /etc/samba/smb.conf{.default,}
$ sudo systemctl enable smbd nmbd

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.

When access hiroom2's home directory "\\<server>\hiroom2", %s at valid users will be "hiroom". Only user hiroom2 can access to hiroom2's home directory.

$ diff -uprN /etc/samba/smb.conf{.default,}
--- /etc/samba/smb.conf.default 2016-05-07 19:20:17.000000000 +0000
+++ /etc/samba/smb.conf 2016-06-04 22:21:46.363333318 +0000
@@ -177,6 +177,7 @@
    comment = Home Directories
    browseable = no
    writable = yes
+   valid users = %S

 # Un-comment the following and create the netlogon directory for Domain Logons
 ; [netlogon]

3.2 Share directory with multiple user.

Share permission 0777 directory with multiple user adde by pdbedit.

$ diff -uprN /etc/samba/smb.conf{.default,}
--- /etc/samba/smb.conf.default 2016-06-04 23:14:59.073333323 +0000
+++ /etc/samba/smb.conf 2016-06-04 23:15:10.246666651 +0000
@@ -283,4 +283,11 @@
 ;   printable = no
 ;   create mask = 0765

+[share]
+   comment = Share directory
+   path = /var/lib/share
+   read only = no
+   guest only = no
+   guest ok = no
+   share modes = yes

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 \\<server>\hiroom2 with explorer.

Input username and password as same as pdbedit.

0001_Authentication-to-pdbedit.png

Accessed to hiroom2's home directory.

0002_Connected-Home-Directory.png

4.1 Map network drive

If mapping network drive, windows 10 will connect to samba automatically when user login.

Move to PC directory in explorer, Select "Map Network drive".

0003_Network-Drive.png

This time, mapping to \\<server>\share.

0004_Network-Drive-Folder.png

Network drive is mapped to samba share directory.

0005_Network-Drive-Completed.png