ArchLinux 2018.10.01: Install samba for SMB server

This article will describe installing samba.

1 Install samba

Install samba.

$ sudo pacman -Sy --noconfirm samba
$ sudo systemctl enable smb nmb

2 pdbedit

Add user access to samba with pdbedit. This user must be exists in Linux. If user to be added by pdbedit does not exist, you need to add user with useradd.

$ sudo useradd -m hiroom2

This article adds hiroom2 with pdbedit.

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

-t option reads password from stdout.

$ yes "${PASSWD}" | sudo pdbedit -a hiroom2 -t

3 /etc/samba/smb.conf

Create base of /etc/samba/smb.conf.

$ cat <<EOF | sudo tee /etc/samba/smb.conf
   workgroup = MYGROUP
   server string = Samba Server
   server role = standalone server
   log file = /var/log/samba/log.%m
   max log size = 50
   dns proxy = no


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

Please reboot smb and nmb after editing smb.conf.

$ sudo systemctl restart smb nmb

3.1 Share home directory for each user

Share home directory for each user added by pdbedit.

$ cat <<EOF | sudo tee -a /etc/samba/smb.conf
   comment = Home Directories
   browseable = no
   read only = no
   valid users = %S


3.2 Share directory with multiple user.

Share permission 0777 directory with multiple user adde by pdbedit.

$ cat <<EOF | sudo tee -a /etc/samba/smb.conf
   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 the following URL with explorer. Sharing home directory is \\\hiroom2. Sharing directory with multiple user is \\\share.