Setting Up Samba File Sharing Between Linux and Windows

Samba has bridged Linux and Windows file sharing since 1992, implementing Microsoft’s SMB/CIFS protocol well enough that a Windows machine can’t tell the difference between a Samba share and a real Windows file server. It’s still the standard way to make a Linux box show up in Windows’ Network view.

Installing and Configuring Samba

sudo apt install -y samba

sudo mkdir -p /srv/shared
sudo chown nobody:nogroup /srv/shared
sudo chmod 0775 /srv/shared
[shared]
   path = /srv/shared
   browseable = yes
   read only = no
   guest ok = no
   valid users = @sambashare
   create mask = 0664
   directory mask = 0775

Creating a Samba User

Samba maintains its own password database separate from the Linux system password — a common source of confusion for first-timers:

sudo addgroup sambashare
sudo usermod -aG sambashare alice

sudo smbpasswd -a alice   # sets the Samba-specific password
sudo systemctl restart smbd nmbd

Connecting from Windows

From File Explorer, navigate to \\linux-server-ip\shared and authenticate with the Samba username and password. On the Linux side, testparm validates your smb.conf syntax before you restart the service — always run it after editing the config, since a typo there silently breaks the whole share.