How to Set Up a Samba File Share on Linux (Access It from Windows and Mac)

A network drive for the whole house: Samba: works with Windows and Mac.

The most useful thing a home server does is hold the family's files somewhere every computer can reach. Samba speaks the same file-sharing language as Windows, so a shared folder on your server shows up in File Explorer and Finder like any network drive. One package, one config block, one password.

Quick reference

TaskCommand
Installsudo apt install samba -y
Config file/etc/samba/smb.conf
Add a Samba password for a usersudo smbpasswd -a john
Check the configtestparm
Restartsudo systemctl restart smbd
Firewallsudo ufw allow samba
Connect from Windows\192.168.1.50\files in the address bar
Connect from MacFinder → Go → Connect to Server → smb://192.168.1.50/files

1. Install and make a folder

sudo apt install samba -y
sudo mkdir -p /srv/files
sudo chown john:john /srv/files

Use a folder on a big drive (tutorial 22) if you have one — /mnt/data/files, say.

2. Add the share

sudo nano /etc/samba/smb.conf

Scroll to the bottom and add:

[files]
path = /srv/files
browseable = yes
read only = no
valid users = john
create mask = 0664
directory mask = 0775

[files] is the name people will see. valid users limits who can connect.

Check for mistakes and restart:

testparm
sudo systemctl restart smbd
sudo ufw allow samba

3. Set a Samba password

Samba keeps its own password list, separate from Linux logins:

sudo smbpasswd -a john

Use the same password as your login or a different one — your choice.

4. Connect

Windows: open File Explorer, type \192.168.1.50\files in the address bar, enter john and the Samba password. Tick Remember my credentials. To make it a drive letter, right-click This PC → Map network drive.

Mac: Finder, Cmd + K, smb://192.168.1.50/files, connect as registered user.

Phone: most file apps (Files on iOS, Solid Explorer on Android) can add an SMB server with the same details.

A share everyone can use without a password

[public]
path = /srv/public
browseable = yes
read only = no
guest ok = yes
force user = john

force user makes every file created belong to you, so permissions never get tangled.

Several users

Create each as a Linux user (sudo adduser sarah), give them a Samba password (sudo smbpasswd -a sarah), add them to valid users, and put them all in a shared group that owns the folder: sudo groupadd family, sudo usermod -aG family sarah, sudo chgrp -R family /srv/files, sudo chmod -R 2775 /srv/files.

Troubleshooting

Windows says "the network path was not found". Firewall (sudo ufw status should show Samba), or smbd isn't running. On the server, smbclient -L localhost -U john should list the share.

"Access is denied" after a correct password. Linux permissions on the folder — the Samba user must be able to write to it. ls -ld /srv/files and chown as needed.

Windows keeps using the wrong credentials. Open Credential Manager → Windows Credentials, remove the entry for the server, and connect again.

Can see the share but it's read-only. read only = no missing, or the folder isn't writable by that user.

Shows up by IP but not by name. Install wsdd (sudo apt install wsdd) so the server appears under Network in File Explorer.

Wrapping up

Install Samba, a six-line share block, smbpasswd -a, restart, allow through the firewall. Then \server\files from Windows or smb://server/files from a Mac, and the whole house has a network drive.

Call us