Learn how to configure a secure Samba server with proper permissions, encryption, and access controls for your network.

What is Samba?

Samba is an open-source implementation of the SMB/CIFS protocol that allows file sharing between Linux and Windows systems.

Prerequisites

  • Ubuntu 20.04 or later
  • sudo/root access

Step 1: Install Samba

sudo apt update
sudo apt install samba

Step 2: Configure Samba

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
sudo nano /etc/samba/smb.conf

Step 3: Create Users and Directories

sudo mkdir -p /srv/sambasecured
sudo groupadd sambashare
sudo useradd -m -G sambashare username
sudo smbpasswd -a username

Step 4: Enable SMBv3 Encryption

min protocol = SMB2
max protocol = SMB3

Step 5: Restart and Test

sudo systemctl restart smbd
sudo testparm

Security Best Practices

  • Disable SMBv1
  • Use strong passwords
  • Enable encryption
  • Use firewall rules