How to Install Samba

File sharing between Linux and Windows machines.

What is Samba?

Samba is the standard Windows interoperability suite of programs for Linux and Unix. It allows you to share files and printers across a network with Windows, macOS, and other Linux machines using the SMB/CIFS protocol.

1 Install Samba

bash
sudo apt update
sudo apt install samba -y

Verify the installation:

bash
whereis samba

2 Create a Share Directory

bash
sudo mkdir -p /samba/share
sudo chmod 777 /samba/share

3 Configure Samba

Edit the Samba configuration file:

bash
sudo nano /etc/samba/smb.conf

Add this section at the bottom of the file:

smb.conf
[Share]
   path = /samba/share
   browseable = yes
   read only = no
   guest ok = yes
   create mask = 0777
   directory mask = 0777

4 Restart Samba

bash
sudo systemctl restart smbd

Check the status:

bash
sudo systemctl status smbd

5 Set Up a Samba User

Create a Samba password for your user (separate from system password):

bash
sudo smbpasswd -a tom

Enable the user:

bash
sudo smbpasswd -e tom

6 Configure Firewall

bash
sudo ufw allow samba

7 Access from Windows

On Windows, open File Explorer and type:

bash
\\\\192.168.1.100\\\\Share

Replace the IP with your server's IP address.

8 Access from macOS

bash
smb://192.168.1.100/Share

Open Finder → Go → Connect to Server, then enter the address above.

Video Tutorial

Home Buy Me a Beer