Samba implements the SMB/CIFS protocol on Linux, enabling file and printer sharing with Windows, macOS, and other Linux machines. It is the standard way to create Linux-based file servers accessible to Windows clients. This guide configures Samba on Ubuntu 26.04 LTS.
Tested and valid on:
- Ubuntu 26.04 LTS
Prerequisites
- Ubuntu 26.04 LTS
- A user with sudo privileges
- Network access from client machines
Step 1 – Install Samba
sudo apt update
sudo apt install samba samba-common-bin -y
smbd --version
Step 2 – Create a Share Directory
sudo mkdir -p /srv/samba/shared
sudo chown -R nobody:nogroup /srv/samba/shared
sudo chmod -R 0775 /srv/samba/shared
Step 3 – Configure Samba
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo nano /etc/samba/smb.conf
Add at the end:
[Shared]
comment = Ubuntu 26.04 Share
path = /srv/samba/shared
browsable = yes
read only = no
guest ok = yes
create mask = 0664
directory mask = 0775
Step 4 – Test Configuration
testparm
Step 5 – Create a Samba User
sudo useradd -M -s /sbin/nologin sambauser
sudo smbpasswd -a sambauser
sudo smbpasswd -e sambauser
Step 6 – Start and Enable Samba
sudo systemctl restart smbd nmbd
sudo systemctl enable smbd nmbd
Step 7 – Configure UFW and Test
sudo ufw allow samba
From a Windows client, press Win+R, type \SERVER_IPShared and press Enter. From Linux:
smbclient //SERVER_IP/Shared -N
ls
Conclusion
Samba is configured on Ubuntu 26.04 LTS. Windows and macOS clients can now access the shared directories. For a production file server, configure user-based authentication, audit logging, and add Samba to Active Directory for centralised user management.