Arch Linux Bare Metal Install · Samba File Server

Set Up a Samba
File Server on Arch

A complete, step-by-step guide to installing and configuring Samba on a bare-metal Arch Linux machine and sharing files with a Windows client over your local network.

Server: 192.168.1.12
Client: 192.168.1.4
Bare Metal Arch Linux
2 users · 2 shares
01

📖Introduction

Samba is a free and open-source re-implementation of the SMB/CIFS networking protocol. It lets Linux and Unix machines share files and printers with Windows systems seamlessly — as if they were native Windows network shares.

This guide is written for a bare-metal Arch Linux installation (not a VM, not a container). You're working directly on real hardware, so every command and config tweak here applies to your actual system.

💡

What you'll achieve

By the end, user potato will have access to the entire root filesystem (/) from Windows, and user asmit will have access to /mnt/sda1 — both over your LAN.

🖥️

Bare Metal Note

Since this is a bare-metal install, all systemd services, network interfaces, and storage mounts reflect your physical machine. There are no hypervisor quirks or bridged adapters to worry about.

02

🌐Network Overview

Here's what we're building. The Arch Linux box is the server; the Windows machine is the client. Both are on the same LAN subnet.

  [ Arch Linux Server ]              [ Windows Client ]
  192.168.1.12                        192.168.1.4
  ┌───────────────────┐              ┌─────────────────────┐
  │  Samba (smbd)     │◄────SMB─────►│  File Explorer      │
  │                   │   port 445   │  net use command    │
  │  [rootfs] share   │──────────────► \\192.168.1.12\rootfs│
  │  path: /          │              │  (user: potato)     │
  │                   │              └─────────────────────┘
  │  [data] share     │              ┌─────────────────────┐
  │  path: /mnt/sda1  │──────────────► \\192.168.1.12\data │
  └───────────────────┘              │  (user: asmit)      │
                                     └─────────────────────┘

  Router / Switch  192.168.1.1
  ─────────────────────────────────────
  Both devices on the same /24 subnet
HostIP AddressRoleOS
archlinux192.168.1.12ServerArch Linux (bare metal)
Windows PC192.168.1.4ClientWindows 10 / 11
Linux UserSamba SharePathAccess
potatorootfs/Full Root
asmitdata/mnt/sda1Data Drive
03

🔧Fix Mirrors (if pacman fails)

On a fresh or long-idle Arch install, the default mirrorlist might be stale, giving you 404 errors when running pacman. Fix it with reflector, which automatically picks fast, up-to-date mirrors.

# Method 1 — Automatic (recommended)

bash
sudo pacman -S reflector
sudo reflector --country India,Singapore,Japan --protocol https --latest 10 --sort rate --save /etc/pacman.d/mirrorlist
sudo pacman -Syy

# Method 2 — Manual fallback

If reflector itself won't download, edit the mirrorlist by hand:

bash
sudo nano /etc/pacman.d/mirrorlist

Delete everything in the file and paste these three reliable mirrors:

mirrorlist
Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch
Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch
Server = https://mirror.pkgbuild.com/$repo/os/$arch

Save with Ctrl+OEnterCtrl+X, then force-refresh:

bash
sudo pacman -Syyu
⚠️

Bare Metal Tip

On a bare-metal Arch install the system clock might be wrong after a long uptime gap. Run sudo timedatectl set-ntp true and wait a few seconds before pacman operations if you get certificate/time errors.

04

📦Install Samba

With mirrors working, install the samba package. This provides smbd (file/print sharing), nmbd (NetBIOS name service), and tools like smbpasswd and smbclient.

bash
sudo pacman -S samba
which smbpasswd

The which smbpasswd command should return /usr/bin/smbpasswd. If it prints nothing, the installation failed — re-check your mirrors from the previous step.

05

👤Create Linux Users

Samba requires that users exist as real Linux system accounts before you can add them to Samba's own password database. Create both users and set their Unix passwords:

bash
sudo useradd -m potato
sudo useradd -m asmit
sudo passwd potato
sudo passwd asmit
ℹ️

The -m flag

The -m flag creates a home directory (/home/potato, /home/asmit). It's not strictly needed for Samba, but it's good practice for real user accounts.

06

🔐Add Samba User Passwords

Samba keeps its own separate password database (/var/lib/samba/private/passdb.tdb). A user can have a different Samba password from their Unix login password. Register both users:

bash
sudo smbpasswd -a potato
sudo smbpasswd -a asmit

You'll be prompted to enter and confirm a Samba password for each user. These are the credentials Windows will use to authenticate.

⚠️

smbpasswd: command not found?

This means Samba didn't install correctly. Re-run sudo pacman -S samba and verify that which smbpasswd returns a path.

07

⚙️Configure smb.conf

The main Samba configuration file lives at /etc/samba/smb.conf. On a fresh Arch install this file does not exist — you create it from scratch. Open it in nano:

bash
sudo nano /etc/samba/smb.conf

Paste the following configuration exactly as shown:

smb.conf
[global]
   workgroup     = WORKGROUP
   server string = Arch Samba Server
   netbios name  = archlinux
   security      = user
   map to guest  = Bad User

[rootfs]
   path        = /
   browsable   = yes
   writable    = yes
   valid users = potato
   read only   = no

[data]
   path        = /mnt/sda1
   browsable   = yes
   writable    = yes
   valid users = asmit
   read only   = no

Save with Ctrl+OEnterCtrl+X. Then validate the config syntax:

bash
testparm

testparm loads the config and reports any syntax errors. If it ends with "Loaded services file OK" you're good to go.

🔑

Key directives explained

security = user — require username/password login. map to guest = Bad User — failed logins silently map to the guest account (harmless with no guest share). valid users — whitelist exactly which Linux users can access each share.

09

▶️Start Samba Services

Samba runs as two systemd services: smb (the SMB/CIFS file server) and nmb (NetBIOS name broadcasting — lets Windows discover the server by hostname). Enable and start both:

bash
sudo systemctl enable --now smb nmb
sudo systemctl status smb
sudo systemctl status nmb

Both services should show active (running) in green. The --now flag means "enable at boot AND start immediately."

💡

After every config change

If you edit smb.conf later, run sudo systemctl restart smb nmb to apply the changes without rebooting.

10

🔥Firewall Fix (Critical!)

This is the most common reason Samba "works" locally but Windows can't connect. UFW (Uncomplicated Firewall) blocks SMB ports by default. Open the four required ports:

PortProtocolPurpose
137/udpUDPNetBIOS Name Service
138/udpUDPNetBIOS Datagram Service
139/tcpTCPNetBIOS Session Service (legacy SMB)
445/tcpTCPDirect SMB over TCP (modern, required)
bash
sudo systemctl enable --now ufw
sudo ufw allow 137/udp
sudo ufw allow 138/udp
sudo ufw allow 139/tcp
sudo ufw allow 445/tcp
sudo ufw reload
sudo ufw status

# Temporary: disable firewall for testing

If Windows still can't connect after opening ports, temporarily disable UFW to confirm the firewall is the culprit:

bash
sudo ufw disable   # disable for testing only — re-enable after!
🚨

Don't leave the firewall disabled

Re-enable it with sudo ufw enable once you've confirmed connectivity. Running Samba without a firewall on a shared network exposes your entire filesystem.

11

🧪Test Samba Locally

Before touching Windows, verify Samba is working from the Linux machine itself using smbclient:

bash
smbclient -L localhost -U potato

Enter potato's Samba password when prompted. You should see a share list like:

expected output
Sharename       Type      Comment
---------       ----      -------
rootfs          Disk
data            Disk
IPC$            IPC       IPC Service

# Verify Samba is listening on port 445

bash
ip a                           # confirm your IP is 192.168.1.12
ss -tulnp | grep 445          # confirm smbd is listening

The ss command should show smbd listening on 0.0.0.0:445.

12

🪟Connect from Windows

Open Command Prompt on the Windows machine (Win + Rcmd → Enter):

# Step 1 — Verify network connectivity

cmd (Windows)
ping 192.168.1.12

You should get replies. If not, the machines can't reach each other — check your router/switch.

# Step 2 — Clear old Windows credentials

cmd (Windows)
net use * /delete

# Step 3 — Map the shares

cmd (Windows)
net use \\192.168.1.12\rootfs /user:potato
net use \\192.168.1.12\data   /user:asmit

Enter the respective Samba passwords when prompted. A success message means the shares are mounted.

13

📂Access via Windows Explorer

Open File Explorer and type any of these directly into the address bar:

Explorer address bar
\\192.168.1.12            ← Browse all shares
\\192.168.1.12\rootfs     ← potato's root share
\\192.168.1.12\data       ← asmit's data share

You can also right-click This PCMap network drive → enter the path → check "Connect using different credentials" → enter the Samba user and password.

💡

Persistent drive mapping

To auto-mount at login, check "Reconnect at sign-in" when mapping the drive in Explorer, or use net use Z: \\192.168.1.12\rootfs /user:potato /persistent:yes in CMD.

14

🚨Troubleshooting

💥 smbpasswd: command not found
Cause: Samba package didn't install.
Fix: Run sudo pacman -S samba again. If pacman fails with 404 errors, fix your mirrors first (Section 03).
💥 pacman: 404 Not Found (failed retrieving file)
Cause: Stale mirrorlist — the package databases are outdated.
Fix: Follow Section 03 to update mirrors with reflector or manually paste three working servers, then run sudo pacman -Syyu.
💥 Can't load /etc/samba/smb.conf - run testparm to debug it
Cause: The config file is missing or has a syntax error.
Fix: Run testparm and read the output carefully. Common mistakes: wrong indentation, typos in key names, missing section headers. Make sure the file is at /etc/samba/smb.conf (not ~/.smb.conf).
💥 Windows cannot access \\192.168.1.12
Cause: Usually firewall blocking port 445, wrong IP, or smbd not running.
Fix: Check in order: (1) ping 192.168.1.12 from Windows — if this fails it's a network issue. (2) sudo ufw status on Linux — make sure ports 137–139 UDP/TCP and 445 TCP are ALLOW. (3) sudo systemctl status smb — make sure it's running.
💥 Firewall blocking connection
Fix — check UFW rules:
bash
sudo iptables -L   # view raw iptables rules
sudo ufw status verbose
Re-run all ufw allow commands from Section 10, then sudo ufw reload.
💥 Wrong IP / server unreachable
Fix: Confirm the server's actual IP:
bash
ip a   # look for inet under your NIC (e.g. eth0, enp3s0)
Update your net use / Explorer path if the IP has changed (assign a static IP or DHCP reservation to avoid this).
💥 Permission denied when accessing share
Cause: Linux filesystem permissions don't allow the Samba user to read/write the path.
Fix: Make sure the path in smb.conf is accessible by the valid users account. For /mnt/sda1, confirm sudo chown -R asmit:asmit /mnt/sda1 was run. Check with ls -la /mnt/sda1.
💥 Windows keeps prompting for password / cached credentials
Cause: Windows cached old/wrong credentials from a previous failed attempt.
Fix: Open Credential Manager (Control Panel → User Accounts → Credential Manager) → Windows Credentials → remove any entry for 192.168.1.12. Then in CMD:
cmd
net use * /delete
Then reconnect with the correct password.