“Samba is free and open-source software that enables file sharing across different operating systems over a network.” It serves as a Linux implementation alternative to the Windows SMB protocol with four primary functions:

  • File & print services
  • Authentication and Authorization
  • Name resolution
  • Service announcement (browsing)

Install Samba Server on Ubuntu

Before installation, update your packages. Install Samba with these commands:

sudo apt-get update
sudo apt-get install samba

Configuring & Creating Your Share Directory

Creating the Share Folder

Create a directory using mkdir:

mkdir /home/username/mysharefolder/

Configuring Share Folder

Edit the Samba configuration file at /etc/samba/smb.conf using nano:

sudo nano /etc/samba/smb.conf

Add the following to the configuration file:

# In the [global] tag add or change the following lines:
server role = standalone server
map to guest = bad user
usershare allow guests = yes
hosts allow = 192.168.0.0/16
hosts deny = 0.0.0.0/0

[linuxsharename]
  comment = Samba on Ubuntu shared folder
  path = /home/username/mysharefolder
  read only = no
  guest ok = yes
  force user = username
  force group = username

Saving, Testing, and Running Samba

Save the file with Ctrl-X. Test the configuration:

testparm

Start the service:

sudo service smbd restart

Update the firewall rules:

sudo ufw allow samba

Accessing Shared Folder From Windows

  1. Open File Explorer
  2. Click Network in the left pane
  3. Enable network discovery if prompted
  4. Enter \\ followed by the host IP address
  5. Enter server login credentials

Samba share from Windows

Accessing Shared Folder From a Mac

  1. Choose Go > Connect to Server in Finder
  2. Enter the network address, for example:
smb://192.168.0.102
  1. Click Connect
  2. Select connection type (Guest, Registered User, or Apple ID)
  3. Enter credentials if needed

The Bottom Line

Setup typically takes no more than 15 minutes and enables cross-platform file sharing between Linux, Windows, and Mac systems.