← All articles
a black and white photo of cubes on a black background

Samba and NFS File Sharing in the Homelab

Storage 2026-03-04 · 3 min read samba nfs smb file sharing homelab linux networking nas storage
By HomeLab Starter Editorial TeamHome lab enthusiasts covering hardware setup, networking, and self-hosted services for home and small office environments.

Network file sharing is fundamental to homelabs: sharing storage between servers, making files accessible from Windows machines, mounting remote filesystems for VM disk images. Samba (SMB protocol) and NFS are the two dominant options. This guide covers setting up both on Linux.

Photo by Shubham Dhage on Unsplash

Samba vs NFS: When to Use Each

SMB/Samba:

NFS:

For mixed Windows/Linux/Mac environments: Samba. For Linux-only infrastructure where performance matters: NFS. Many homelabs run both.

Samba Setup

Installation

sudo apt update
sudo apt install samba

Basic Share Configuration

# Back up original config
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

# Edit config
sudo nano /etc/samba/smb.conf

/etc/samba/smb.conf:

[global]
   workgroup = WORKGROUP
   server string = Homelab Samba
   server role = standalone server
   security = user
   map to guest = bad user
   smb ports = 445
   min protocol = SMB2

# Public share (no password required)
[public]
   comment = Public Share
   path = /srv/samba/public
   browseable = yes
   writable = yes
   guest ok = yes
   create mask = 0664
   directory mask = 0775
   force group = nogroup

# Private share (requires authentication)
[media]
   comment = Media Library
   path = /srv/samba/media
   browseable = yes
   writable = yes
   valid users = mediauser, admin
   create mask = 0660
   directory mask = 0770

Create Directories and Set Permissions

# Create directories
sudo mkdir -p /srv/samba/public /srv/samba/media

# Set permissions for public share
sudo chown -R nobody:nogroup /srv/samba/public
sudo chmod -R 0775 /srv/samba/public

# Set permissions for private share
sudo chown -R mediauser:mediauser /srv/samba/media
sudo chmod -R 0770 /srv/samba/media

Create Samba Users

# Samba users must be existing Linux users
sudo adduser mediauser  # If user doesn't exist

# Set Samba password (separate from Linux password)
sudo smbpasswd -a mediauser
sudo smbpasswd -e mediauser  # Enable the user

Start and Enable Samba

sudo systemctl enable smbd nmbd
sudo systemctl restart smbd nmbd

# Test configuration
sudo testparm

# Check if shares are visible
smbclient -L localhost -U mediauser

Accessing from Clients

Linux (mount -t cifs):

# Install cifs-utils
sudo apt install cifs-utils

# Mount share
sudo mount -t cifs //192.168.1.50/media /mnt/media \
  -o username=mediauser,password=your-password,vers=3.0

# Persistent mount in /etc/fstab
//192.168.1.50/media /mnt/media cifs username=mediauser,password=your-password,vers=3.0,_netdev 0 0

Windows: File Explorer → map network drive → \\192.168.1.50\media

macOS: Finder → Go → Connect to Server → smb://192.168.1.50/media

Samba for Proxmox Backup

Add a Samba share as Proxmox backup storage:

  1. Proxmox UI → Datacenter → Storage → Add → SMB/CIFS
  2. Enter server, share name, credentials
  3. Proxmox can now backup to this share

NFS Setup

Installation

sudo apt install nfs-kernel-server

Configure Exports

sudo nano /etc/exports

/etc/exports:

# Export /data to specific host (full read/write)
/srv/nfs/data    192.168.1.100(rw,sync,no_subtree_check,no_root_squash)

# Export to entire subnet
/srv/nfs/media   192.168.1.0/24(rw,sync,no_subtree_check)

# Read-only export
/srv/nfs/backup  192.168.1.0/24(ro,sync,no_subtree_check)

# Multiple clients
/srv/nfs/vmdata  192.168.1.10(rw,sync,no_subtree_check) 192.168.1.11(rw,sync,no_subtree_check)

Export options explained:

Apply Exports

sudo mkdir -p /srv/nfs/data /srv/nfs/media
sudo exportfs -rav
sudo systemctl enable --now nfs-kernel-server

Verify exports:

showmount -e localhost

Client Setup

# Install NFS client
sudo apt install nfs-common

# Mount NFS share
sudo mount -t nfs 192.168.1.50:/srv/nfs/data /mnt/nfs-data

# Verify
df -h | grep nfs
mount | grep nfs

# Persistent mount in /etc/fstab
192.168.1.50:/srv/nfs/data /mnt/nfs-data nfs defaults,_netdev 0 0

NFS on Proxmox

Add NFS storage in Proxmox:

  1. Datacenter → Storage → Add → NFS
  2. Server: 192.168.1.50
  3. Export: /srv/nfs/vmdata
  4. Content: VMs, Container templates, Disk images, etc.

NFS performs well for Proxmox VM disk images, especially on fast internal networks.

Performance Comparison

Protocol Typical throughput Latency CPU overhead
SMB3 100-900 MB/s Low Moderate
NFSv4 100-1100 MB/s Very low Low
NFSv3 100-900 MB/s Very low Very low

NFS has slightly lower overhead than Samba, particularly for sequential I/O. The difference is minimal for most homelab workloads; network speed is usually the bottleneck.

Security Considerations

Samba: Use SMB2 minimum (min protocol = SMB2). Require authentication for sensitive shares. Don't expose to the internet.

NFS: Restrict to specific IP addresses or subnets. NFSv4 with Kerberos provides strong authentication. For homelab internal use, IP-based restrictions are usually sufficient.

Both should be on a trusted internal network only. Neither should be exposed directly to the internet without a VPN.

Get free weekly tips in your inbox. Subscribe to HomeLab Starter