Setting Up a Home File Server with Samba on Ubuntu
A home file server gives computers on the same network a shared place for documents, photographs, music, installers, and backups. Instead of moving files with USB drives or paying for additional cloud storage, a spare Ubuntu computer can provide central storage through Samba, the open-source implementation of Microsoft’s SMB file-sharing protocol.
This arrangement suits a household with a desktop in Melbourne, a laptop moving between rooms in Brisbane, or several family devices connected through an Australian NBN router. It can also extend the useful life of an older PC, provided the machine has reliable storage, adequate cooling, and a wired network connection.
The setup is straightforward, but a dependable server requires more than installing one package. User accounts, permissions, firewall rules, network discovery, backup habits, and power management all affect whether the shared folder remains convenient and safe. The commands below use a modern Ubuntu installation and avoid exposing personal files directly to the internet.
Choosing The Computer And Storage
A Samba server does not require a powerful processor. A modest Intel or AMD desktop, small-form-factor PC, or recent Raspberry Pi running Ubuntu can serve a few household users. Memory of 4 GB is generally enough for file sharing, while a gigabit Ethernet port is more important than high CPU performance. Wi-Fi can work, but a wired connection reduces dropouts during large transfers.
Storage deserves more attention than processor speed. A new NAS-rated hard disk is suitable for a media library or document archive, while an SSD makes the system quiet and responsive but may cost more per terabyte. Australian retailers commonly sell bare drives and USB enclosures from brands such as Seagate, Western Digital, and Toshiba; check the warranty and return terms rather than selecting solely by advertised capacity.
Keep the operating system on a separate drive when possible. If a system disk fails, replacing Ubuntu should not require rebuilding the data volume. Format a dedicated disk with a Linux filesystem such as ext4, mount it consistently through /etc/fstab, and place shared material beneath a clear path such as /srv/files. A single disk is not a backup: a second local disk, an external drive, or an encrypted cloud copy is still needed.
Installing Samba And Creating A Share
Update Ubuntu and install the server packages:
sudo apt update
sudo apt install samba smbclient
Create a private directory and a group for authorised household users:
sudo groupadd fileshare
sudo mkdir -p /srv/files/shared
sudo chown -R root:fileshare /srv/files
sudo chmod -R 2770 /srv/files
The 2 in 2770 sets the setgid bit, causing new files and directories to inherit the fileshare group. The final permissions allow the owner and group to read, write, and enter the directory, while everyone else has no access. If different people need separate private folders, create them individually rather than giving every user unrestricted access to the whole volume.
Create a Linux account for each person who needs access. The account does not need to be used for logging into the Ubuntu desktop:
sudo adduser alex
sudo usermod -aG fileshare alex
sudo smbpasswd -a alex
The Samba password can differ from the Linux login password. Repeat the process for other household members, then open the configuration file:
sudo nano /etc/samba/smb.conf
Add a share definition at the bottom:
[Shared Files]
path = /srv/files/shared
browseable = yes
read only = no
guest ok = no
valid users = @fileshare
force group = fileshare
create mask = 0660
directory mask = 2770
The share name in square brackets is what clients will see. guest ok = no prevents anonymous access, while valid users limits entry to members of the Linux group. Save the file and check its syntax:
testparm
If the output reports no serious errors, restart Samba and arrange for it to start automatically:
sudo systemctl restart smbd
sudo systemctl enable smbd
Securing The Local Network
A home file server should be reachable from the local network, not from the public internet. Samba uses several SMB-related ports, and forwarding those ports on an NBN modem or router is a serious security mistake. Disable UPnP port forwarding for the server if the router allows it, and never publish TCP port 445 simply to make files available while travelling.
Ubuntu’s uncomplicated firewall can allow Samba only on the local network profile:
sudo ufw allow from 192.168.1.0/24 to any app Samba
sudo ufw enable
sudo ufw status
The address range may differ. Many Australian households use routers configured with 192.168.0.x or 192.168.1.x, but the correct range is shown by the router’s administration page or the output of ip addr. If the computer has a static address such as 192.168.1.20, reserving that address in the router’s DHCP settings makes client connections easier and prevents the server’s address changing unexpectedly.
SMB encryption and signing settings should reflect the clients in the household. Modern Ubuntu, Windows, and macOS releases generally negotiate secure SMB behaviour, but old televisions, printers, or media players may require outdated protocols. Do not enable SMB1 merely because an old device cannot connect; SMB1 is obsolete and carries considerable security risk. Replace the device, update its firmware, or keep it on a separate network.
Passwords should be unique to the file server, and unused Samba accounts should be disabled or removed. Review the logs with journalctl -u smbd when access fails. If the server is exposed to guests, children’s devices, or smart-home equipment, a guest Wi-Fi network or a separate VLAN can provide additional separation. A VPN such as WireGuard is the safer route for remote access, rather than opening Samba to the internet.
Connecting Windows, macOS, And Linux
On Windows, open File Explorer and enter the server address in the location bar, using the format \\192.168.1.20\Shared Files. Enter the Samba username and password when prompted, then choose to remember the credentials only on a trusted personal computer. Mapping the share as a network drive gives it a familiar drive letter, though reconnecting at sign-in can fail if the server is powered off.
On macOS, select Go, then Connect to Server, and enter smb://192.168.1.20/Shared%20Files. Finder will ask for the registered user’s credentials. Linux desktop environments usually offer a Network or Other Locations view; an address such as smb://192.168.1.20/Shared%20Files opens the same location. Testing from the command line can reveal whether the problem is authentication or graphical discovery:
smbclient //192.168.1.20/"Shared Files" -U alex
Name discovery is convenient but not essential. Some routers block the broadcasts used to display devices automatically, and newer operating systems may hide old browsing protocols. Connecting by the server’s fixed local address is usually more dependable. A local DNS name such as fileserver.home can be useful if the router supports custom hostnames, but address reservations are a good starting point.
Samba is especially useful for a shared photography directory. A household can store camera originals on the server and edit copies from a workstation, using an application such as GIMP 2.2 review as part of a broader image workflow. Keep in mind that editing large RAW files across Wi-Fi may feel sluggish; copy active projects to a local SSD and return finished files to the server.
Maintaining Performance And Backups
File sharing performance depends on the slowest link. Gigabit Ethernet can transfer large files far faster than a crowded 2.4 GHz wireless network, while Wi-Fi 6 improves responsiveness when the access point and client both support it. Do not place the server in a closed cupboard where heat accumulates, particularly during an Australian summer in Adelaide or Perth. Dust filters, airflow, and a small uninterruptible power supply can protect both hardware and data during heatwaves and short power interruptions.
Use df -h to watch free space and du to locate unexpectedly large directories. Logs, temporary exports, duplicated videos, and old Ubuntu installation images can quietly consume a disk. SMART monitoring through smartmontools can provide early warnings for supported drives:
sudo apt install smartmontools
sudo smartctl -a /dev/sda
Confirm the correct device name before running diagnostic commands. A drive showing reallocated sectors, pending sectors, or repeated read errors should be replaced after its contents have been copied elsewhere.
A practical backup arrangement follows the 3-2-1 principle: keep three copies of important data, on two different types of storage, with one copy away from the home. The Samba share can be the working copy, an external USB drive can provide a local backup, and encrypted cloud storage or a drive stored at a trusted relative’s home can cover theft, fire, and catastrophic hardware loss. Test restoring a few files rather than assuming a backup is usable because a program reported success.
The following options suit different budgets and household requirements:
| Approach | Best suited to | Strengths | Limitations |
|---|---|---|---|
| Ubuntu with Samba | A spare PC and technically confident household | Flexible, inexpensive, detailed permissions | Requires maintenance and Linux administration |
| Two-bay NAS | Central storage with a polished interface | Easier monitoring, RAID options, mobile apps | Higher purchase cost and vendor dependence |
| USB drive attached to a router | Occasional document sharing | Low cost and simple hardware | Often slow, limited permissions, variable reliability |
| Cloud storage | Access across locations and automatic synchronisation | Off-site copies and convenient remote access | Ongoing fees, internet dependence, privacy considerations |
| External drive backups | Archiving and disaster recovery | Offline protection and straightforward restoration | Does not provide continuous shared access |
Regular maintenance should be quiet and predictable. Install Ubuntu security updates, check that smbd is running after kernel upgrades, and review who has access when a housemate leaves or a family member changes devices. Keep the server’s address, usernames, backup schedule, and recovery steps in a password manager or printed emergency record stored securely. With those habits, a modest Ubuntu computer becomes a reliable local file hub rather than another fragile gadget.