Build a Samba server on Arch Linux

Samba is software that enables file and printer sharing between Windows and UNIX. Not only Linux and Mac, but also smart devices like Android and iOS can connect to the server.

NFS is a well-known non-Samba file server. For NFS, refer to Building an NFS server on Arch Linux.

server

Installation

samba Install the package.

# pacman -Syu samba

Samba settings

Create /etc/samba/smb.conf. The following is an example of a configuration file that shares / data / share / public.

/etc/samba/smb.conf


[global]

#It is case sensitive.
case sensitive = yes

#Do not try DNS resolution if the NetBIOS name is not found.
dns proxy = no

# 192.168.0.0/24 and 127.0.0.0/8 (Loopback)Allow access from.
hosts allow = 192.168.0. 127.

#Prohibit access from the root user.
invalid users = root

#Set the name of the log file.%m is replaced with the NetBios name.
log file = /var/log/samba/%m.log

#Specifies the maximum size of the log file in KB.
max log size = 10000

#Disable SMB1 and use SMB2 or later.
server min protocol = SMB2

#Operate in standalone mode, where authentication and resource management are completed on this server.
server role = standalone server

#Set the server description.%h is replaced with the host name.
server string = Samba File Server on %h

#Workaround for Mac issues with creating weird permissions ignoring create masks.
unix extensions = no

#The server sendsfile()Use this to optimize performance.
use sendfile = yes

#Set the name of the workgroup appropriately.
workgroup = WORKGROUP

#Define a shared file server accessible to all Samba users.
[public]

    #Specify the file path on the server.
    path = /data/share/public

    #Authenticate using your username and password.
    security = user

    #Allows writing as well as reading to shared files.
    writable = yes

Creating a shared directory

Create a directory to share if it does not already exist. I set the permissions to 777 so that other users can access it.

# mkdir -p /data/share/public
# chmod 777 /data/share/public

Firewall settings

Open TCP ports 137, 138, 139, 445. The following is an example of iptables configuration.

/etc/iptables/iptables.rules


-A INPUT -m state --state NEW -m tcp -p tcp --syn -m multiport --dports 137,138,139,445 -j ACCEPT

Start the Samba server

Start smbd and nmbd.

# systemctl start smb nmb

Also, set smbd and nmbd to start automatically after a system reboot.

# systemctl enable smb nmb

Add Samba user

Use a Linux user to access Samba. Create a Linux user in advance, such as by using the ʻuseraddcommand. However, you must set a Samba-specific password separate from the Linux user password. Use thepdbedit` command to set the password.

# pdbedit -a -u name

There is also a way to synchronize your Linux login password with your Samba password, but this is not covered here.

client

Mac

Click "Move" and "Connect to Server (Command + K)" to display a dialog. Enter an address such as nfs: //192.168.0.16/public.

However, this will cause it to be unmounted when the system is rebooted. To mount it automatically, select the above mount point from "System Preferences", "Users and Groups", "Login Items", and "+".

Android

Download the appropriate filer application for Samba from the Google Play store. I'm using CX File Explorer (https://play.google.com/store/apps/details?id=com.cxinventor.file.explorer&hl=ja). You can access the Samba server in CX File Explorer by following these steps:

  1. Open the Network tab and click the+button.
  2. Open the Remote tab and select SMB.
  3. Enter the host`` user name password and click the ʻOK` button.

Recommended Posts

Build a Samba server on Arch Linux
Build a simple WebDAV server on Linux
[Part 2] Let's build a web server on EC2 Linux
Install Arch Linux on DeskMini A300
Run a Linux server on GCP
Build a Pypi cache server on QNAP
Build a web server on your Chromebook
jblas on Arch Linux
Build an Arch Linux environment on Raspberry Pi
Install Minecraft on Arch Linux
Downgrade Mcomix on Arch Linux
Set up a file server on Ubuntu 20.04 using Samba
[Part 1] Let's set up a Minecraft server on Linux
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux and build a Web server ―― 1. Apache introduction
How to build a Python environment on amazon linux 2
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux and build a Web server --2 PHP introduction
Build a server on Linux and local network with Raspberry Pi NextCloud and desktop sharing
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux to build a Web server --3 MySQL 8.0 introduction
Install LAMP on Amazon Linux 2 and build a WordPress environment.
Build a python environment on CentOS 7.7 for your home server
Setting up OpenSSH on Arch Linux
Rip Music CDs on Arch Linux
Create a Linux environment on Windows 10
Run TensorFlow2 on a VPS server
Build a python3 environment on CentOS7
Linux file server construction (Ubuntu & Samba)
Build a Selenium environment on Amazon Linux 2 in the shortest time
Host the network library Mirror for Unity on a Linux server
What I stumbled upon when using CodeIgniter on a Linux server
How to build my own Linux server
[UE4] Build DedicatedServer on Windows and Linux
Easily build a DNS server using Twisted
Set up a Samba server with Docker
Build a python environment on MacOS (Catallina)
Build CGI Server running on Python 3 on Docker
Make Unity Accelerator a service on Linux
Build an LNPP environment on Amazon Linux 2
Basic usage of Btrfs on Arch Linux
Dockerfile: Install Docker on your Linux server
Build jupyter notebook on remote server (CentOS)
[Linux] Build a jenkins environment with Docker
Arch on lvm on luks build and initialization
Create a Linux virtual machine on Windows
Build a Python + OpenCV environment on Cloud9
Until you install Arch Linux on VMware
Run Jupyter notebook on a remote server
[Linux] Build a Docker environment with Amazon Linux 2
Build a CentOS Linux 8 environment with Docker and start Apache HTTP Server
Verification of how to periodically execute a script on a Linux server on Windows
Build Linux on a Windows environment. Steps to install Laradock and migrate
Build a proxy server with nginx on multiple remote servers using Ansible
Build a local server with a single command [Mac]
Build a LAMP environment on your local Docker
Build a WardPress environment on AWS with pulumi
Install Windows 10 from a Linux server with PXE
Open a ZIP created on Windows in Linux
Simply build a Python 3 execution environment on Windows
Build a Django environment on Raspberry Pi (MySQL)
Build a python environment with ansible on centos6
Build a Python environment on Mac (Mountain Lion)
Linux server command