If you’re working in a mixed network environment with both Windows and Linux systems, you’ll definitely need Samba — a powerful open-source suite that enables file, printer, and network resource sharing across different operating systems using the SMB/CIFS (Server Message Block / Common Internet File System) protocol.
Samba acts as a bridge between Linux and Windows, allowing Windows users to easily access shared folders, printers, or even domain controllers hosted on Linux.
Advantages of Samba:
- Free, stable, and highly flexible.
- Excellent compatibility with Windows, easy to integrate into LANs.
- Supports creating file servers and print servers.
- Can integrate with Active Directory for user authentication and access control.
Samba is widely used in enterprises, educational institutions, and professional IT infrastructures due to its stability and flexibility in various environments.
Preparation before Installation
Before installing Samba on Ubuntu or Debian, make sure your system. Has updated packages and repositories:
sudo apt update && sudo apt upgrade -y
Installing Samba
To install Samba, run the following command:
sudo apt install samba -y
This command will install the necessary packages including smbd and nmbd, enabling Samba services to operate and be discoverable on the LAN.
After installation, check the Samba version:
samba --version
For example, if it shows version 4.19, the installation was successful.
Enabling Samba Services
To make Samba start automatically with the system and be ready for users, enable both smbd and nmbd services:
sudo systemctl enable smbd --now
sudo systemctl enable nmbd --now
- The
--nowflag activates and starts the service immediately. - smbd manages file and printer sharing.
- nmbd handles NetBIOS name service and allows Samba to be discovered in the LAN.
Checking Service Status
To ensure the services are running properly, run:
sudo systemctl status smbd
sudo systemctl status nmbd
If you see active (running) in green, the services are working correctly.
Firewall Configuration (if using UFW)
Before other devices can access Samba on the LAN, make sure the firewall allows Samba traffic. Check the firewall status:
sudo ufw status
If the firewall is inactive, you can skip this step.
If the firewall is active, allow Samba through:
sudo ufw allow Samba
This command opens all necessary ports for both smbd and nmbd, enabling LAN devices to connect and share files.
Conclusion
After completing these steps, your system now has a basic Samba server running reliably.
You have installed Samba, enabled services, checked their status, and configured the firewall for LAN access.
In future tutorials or articles, you can explore:
- Creating shared folders with specific access permissions.
- Managing users and access rights.
- Connecting to Samba from Windows or other Linux machines.
Samba is a powerful and flexible tool that allows you to build an efficient, secure, and free data-sharing system across your network.
Read more
- Samba – Part 3 – Set Up Samba with Separate Read/Write Access for Each User
- Samba – Part 2 – Share a Folder with Read and Write Access in LAN
- Samba – Part 1 – Install Samba Server on Linux Ubuntu | Debian
- How to Install Windows Server 2025 on Hyper-V (Step-by-Step Tutorial)
- How to Install Android on Hyper-V using BlissOS on Windows