← Projects
raspberry-pi beginner Jul 15, 2026 ◑ 51 views ◯ 3 min read

Build a Raspberry Pi NAS with Samba File Sharing

Build time: 2-3 hours
Tools needed: None required
raspberry pinassambafile servernetwork storagediy
Parts List

Prices and availability as of Nov 22, 3:16 AM ET and subject to change. The price shown on Amazon at the time of purchase applies.

Turn a Raspberry Pi into a proper Network Attached Storage box — a shared drive any Windows, Mac, or Linux machine on your network can access like a regular folder, at no ongoing cost beyond the hardware itself.

Install the OS

Flash Raspberry Pi OS Lite (headless, no desktop needed for a file server) and enable SSH directly in Raspberry Pi Imager's settings before first boot — no need to connect a monitor at all.

Mount Your Storage Drive

# Find your connected drive
lsblk

# Create a mount point
sudo mkdir -p /mnt/storage

# Mount it (replace sda1 with your actual drive identifier)
sudo mount /dev/sda1 /mnt/storage

# Get the drive's UUID for a permanent mount
sudo blkid /dev/sda1

Add the drive to /etc/fstab so it mounts automatically on every boot:

sudo nano /etc/fstab
# Add this line (replace UUID and filesystem type with yours):
UUID=your-uuid /mnt/storage ext4 defaults,auto,users,rw,nofail 0 0

If the drive is NTFS-formatted (common if it was previously used with Windows):

sudo apt install ntfs-3g -y
# Use "ntfs" instead of "ext4" as the filesystem type in fstab

Install and Configure Samba

sudo apt update
sudo apt install samba samba-common-bin -y

Edit the Samba config to define your share:

sudo nano /etc/samba/smb.conf

Add this block at the bottom:

[Storage]
path = /mnt/storage
browseable = yes
writeable = yes
create mask = 0775
directory mask = 0775
valid users = pi

Set Your Samba Password and Start the Service

# Add your Pi user to Samba (use your actual Pi username)
sudo smbpasswd -a pi
# Enter and confirm a password — this is separate from your SSH login password

sudo systemctl restart smbd
sudo systemctl enable smbd

Connect From Other Devices

Windows: Open File Explorer and type \\piname.local\Storage in the address bar, then enter your Samba credentials.

Mac: Finder → Go → Connect to Server → smb://piname.local/Storage

Linux:

sudo apt install smbclient cifs-utils
sudo mount -t cifs //piname.local/Storage /mnt/piserver -o username=pi

Fixing Permission Issues

If you can connect but can't actually write files to the share, fix ownership and permissions on the mounted drive directly:

sudo chown -R pi:pi /mnt/storage
sudo chmod -R 775 /mnt/storage

Performance Expectations

Tips