Building a Raspberry Pi Samba File Server with SSD (Access Files Anywhere!)
With a growing collection of documents, videos, project files, and backups, I decided to build a low-cost, power-efficient file server using my Raspberry Pi and a Samsung T7 SSD. I wanted global access, private sharing, and solid performance—and I achieved it all with Samba, ZeroTier, and some smart automation. Here’s how I turned my Raspberry Pi into a portable, secure Samba file server.
Sujit Rayaprolu
6/1/20252 min read
🧰 What I Used
Raspberry Pi 4 (8GB RAM)
Samsung T7 SSD (1TB)
Raspberry Pi OS (Lite version)
Samba (for file sharing)
ZeroTier (for secure remote access)
Static IP & Auto-mount on boot
⚠️ Challenges I Faced
1. SSD Auto-Mount Fails After Reboot
If you don’t properly mount the SSD using UUID in /etc/fstab, it might fail to mount at boot.
✅ Fix: Used blkid to get the UUID and configured fstab with correct mount options.
2. Samba Permissions Errors
Initially, I couldn’t write files to the share even though I could read them.
✅ Fix: Fixed ownership and permissions using chown and chmod, and ensured Samba was configured with the correct user mapping.
3. Global Access with Security
I didn’t want to expose my Pi to the open internet, so I needed a secure tunnel.
✅ Solution: I used ZeroTier to create a private mesh VPN and accessed Samba over it using my ZeroTier IP.
🛠️ Step-by-Step Setup Guide
📦 Step 1: Update Your Raspberry Pi
=> sudo apt update && sudo apt upgrade -y
🔌 Step 2: Connect & Mount Your SS
1. Plug in your SSD and Check if it’s detected:
=> lsblk
2. Format (Optional):
=> sudo mkfs.ext4 /dev/sda1
3. Mount SSD:
=> sudo mkdir /mnt/ssd sudo mount /dev/sda1 /mnt/ssd
4. Make It Permanent (Auto-mount on Boot):
Get UUID:
=> sudo blkid
=> sudo nano /etc/fstab
Add this line:
=> UUID=xxxx-xxxx /mnt/ssd ext4 defaults,nofail 0 0
Test it:
=> sudo mount -a
📁 Step 3: Install Samba
sudo apt install samba -y
Create a shared folder:
sudo mkdir /mnt/ssd/shared sudo chown -R pi:pi /mnt/ssd/shared sudo chmod -R 775 /mnt/ssd/shared
🔐 Step 4: Configure Samba
Edit the config file:
sudo nano /etc/samba/smb.conf
Add to the bottom:
path = /mnt/ssd/shared browseable = yes read only = no guest ok = no create mask = 0775 directory mask = 0775
Add your user to Samba:
sudo smbpasswd -a pi
Restart Samba:
sudo systemctl restart smbd
You can now access the share on:
🌐 Step 5: Enable Global Access with ZeroTier
Install ZeroTier:
curl -s https://install.zerotier.com | sudo bash sudo zerotier-cli join <your-network-id>
Once authorized on your ZeroTier dashboard, you’ll get a virtual IP like 192.168.191.x. Access your share from anywhere:
🔒 Bonus: Improve Security
Use strong Samba passwords
Restrict access by IP if not using VPN
Regularly back up your config with rsync or rclone
🧠 Final Thoughts
Setting up a Samba server on the Pi with an SSD turned it into a compact NAS. With ZeroTier, I can now access files from anywhere securely—even from my Android phone or laptop on the go.
This project is perfect for:
Sharing files across your local or remote devices
Backups and media storage
Keeping your hacker tools synced (yes, even those 😎)
🔗 Project GitHub & Resources
📁 GitHub Repo: github.com/HardwareArchitect/pi-samba-server (coming soon)
🌐 Domain: sujit.cloud
📄 PDF Guide: Available on GitHub release page
Questions? Suggestions?
Feel free to reach out or fork my project! Let’s build a better personal cloud—one Pi at a time. 🚀