Samba lets you share files between Linux and Windows machines over a network using the SMB/CIFS protocol. On a Linux Mint desktop, this is the most practical way to make folders accessible to Windows PCs on the same LAN, or to mount Windows shares on your Mint box. The setup takes about 10 minutes.
This guide covers two share types: a public share that anyone on the network can access without a password, and an authenticated share restricted to specific Samba users. The server side runs on Linux Mint (or Ubuntu), and we test access from Linux clients, Windows, and the Mint file manager.
Tested March 2026 on Ubuntu 24.04 (same packages as Linux Mint 22). Samba 4.19.5.
Server Side: Install and Configure Samba
All steps in this section run on the Linux Mint machine that will host the shared folders.
Install Samba
Open a terminal and install the Samba server package:
sudo apt update
sudo apt install -y samba samba-common-bin
Verify Samba installed and the service is running:
smbd --version
sudo systemctl status smbd --no-pager | head -5
Confirm smbd shows active (running):
Version 4.19.5-Ubuntu
● smbd.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smbd.service; enabled; preset: enabled)
Active: active (running) since Thu 2026-03-26 11:43:19 UTC; 22ms ago
Docs: man:smbd(8)
Create Share Directories
Create two directories: one for the public share and one for authenticated access. Using /srv/samba/ keeps shares organized and separate from home directories.
sudo mkdir -p /srv/samba/public
sudo mkdir -p /srv/samba/projects
Set permissions. The public share needs world-writable access. The projects share is restricted to the sambashare group (created automatically when Samba is installed), with the setgid bit so new files inherit the group:
sudo chmod 0777 /srv/samba/public
sudo chgrp sambashare /srv/samba/projects
sudo chmod 2770 /srv/samba/projects
Create a Samba User
Samba maintains its own user database, separate from Linux system users. Create a dedicated Samba user with no login shell and add them to the sambashare group:
sudo useradd -M -d /dev/null -s /usr/sbin/nologin -G sambashare smbuser1
Set the Samba password (this is separate from any Linux password):
sudo smbpasswd -a smbuser1
sudo smbpasswd -e smbuser1
The -a flag adds the user to the Samba database. The -e flag enables the account. You’ll be prompted to enter and confirm the password.
To add more users later, repeat these commands with a different username. Any user in the sambashare group automatically gets access to the projects share.
Configure smb.conf
Back up the default configuration file, then replace it:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo vi /etc/samba/smb.conf
Replace the contents with:
[global]
workgroup = WORKGROUP
server string = Samba on %h
server role = standalone server
log file = /var/log/samba/log.%m
max log size = 1000
logging = file
map to guest = bad user
[public]
comment = Public Share (no authentication required)
path = /srv/samba/public
browseable = yes
read only = no
guest ok = yes
create mask = 0664
directory mask = 0775
[projects]
comment = Authenticated project share
path = /srv/samba/projects
browseable = yes
read only = no
guest ok = no
valid users = @sambashare
create mask = 0660
directory mask = 2770
force group = sambashare
What each section does:
- [global] – Sets the workgroup (match your Windows network, typically WORKGROUP), logging, and maps unknown users to guest access.
- [public] – A share at
/srv/samba/publicthat anyone on the network can read and write without credentials.guest ok = yesis the key setting. - [projects] – A share at
/srv/samba/projectsrestricted to members of thesambasharegroup.force group = sambashareensures all files created through Samba are owned by the group, preventing permission issues between users.
Validate and Start
Check the configuration for syntax errors:
testparm -s
A clean config produces:
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Server role: ROLE_STANDALONE
[global]
log file = /var/log/samba/log.%m
map to guest = Bad User
max log size = 1000
server role = standalone server
server string = Samba on %h
[public]
comment = Public Share (no authentication required)
create mask = 0664
directory mask = 0775
guest ok = Yes
path = /srv/samba/public
read only = No
[projects]
comment = Authenticated project share
create mask = 0660
directory mask = 02770
force group = sambashare
path = /srv/samba/projects
read only = No
valid users = @sambashare
If testparm shows errors, fix them before proceeding. Now restart Samba to apply the new configuration:
sudo systemctl restart smbd nmbd
Samba uses two services: smbd handles file sharing, nmbd handles NetBIOS name resolution so Windows machines can find the server by hostname.
Open the Firewall
If ufw is enabled, allow Samba through:
sudo ufw allow samba
sudo ufw status
This opens TCP ports 139 and 445 (SMB), plus UDP ports 137 and 138 (NetBIOS):
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
Samba ALLOW Anywhere
Verify Samba is listening:
ss -tlnp | grep -E "445|139"
Both ports should show as LISTEN:
LISTEN 0 50 0.0.0.0:139 0.0.0.0:* users:(("smbd",pid=12872,fd=31))
LISTEN 0 50 0.0.0.0:445 0.0.0.0:* users:(("smbd",pid=12872,fd=30))
The server is ready. Everything below happens on the client machine.
Client Side: Access Shares from Linux
These steps run on the machine that needs to access the shared folders (another Linux Mint box, Ubuntu, Debian, or any Linux distribution). Replace 192.168.1.130 with your Samba server’s IP address throughout.
Install Client Tools
Install the SMB client and CIFS mount utilities:
sudo apt install -y smbclient cifs-utils
List Available Shares
Discover what the Samba server is sharing:
smbclient -L //192.168.1.130 -N
The -N flag means no password (anonymous). Both shares should appear:
Sharename Type Comment
--------- ---- -------
public Disk Public Share (no authentication required)
projects Disk Authenticated project share
IPC$ IPC IPC Service (Samba on samba-server)
Interactive Access with smbclient
Connect to the public share as a guest:
smbclient //192.168.1.130/public -N
This drops you into an interactive SMB shell where you can use ls, get, put, and exit:
smb: \> ls
. D 0 Thu Mar 26 11:57:32 2026
.. D 0 Thu Mar 26 11:57:32 2026
readme.txt N 28 Thu Mar 26 11:46:47 2026
smb: \> put /etc/hostname testfile.txt
putting file /etc/hostname as \testfile.txt (12.7 kb/s) (average 12.7 kb/s)
smb: \> exit
For the authenticated projects share, connect as smbuser1:
smbclient //192.168.1.130/projects -U smbuser1
Enter the Samba password when prompted. Attempting guest access to this share is correctly denied:
smbclient //192.168.1.130/projects -N
The connection is rejected as expected:
tree connect failed: NT_STATUS_ACCESS_DENIED
Mount Shares with CIFS
For regular file access through your file manager and applications (not just the interactive SMB shell), mount the share to a local directory:
sudo mkdir -p /mnt/samba-public
sudo mount -t cifs //192.168.1.130/public /mnt/samba-public -o guest
For the authenticated share:
sudo mkdir -p /mnt/samba-projects
sudo mount -t cifs //192.168.1.130/projects /mnt/samba-projects -o username=smbuser1
Verify both mounts are active:
df -hT | grep cifs
Both shares should appear as mounted filesystems:
//192.168.1.130/public cifs 29G 2.4G 26G 9% /mnt/samba-public
//192.168.1.130/projects cifs 29G 2.4G 26G 9% /mnt/samba-projects
Persistent Mounts with fstab
The mounts above are lost on reboot. To make them persistent, add entries to /etc/fstab.
For the authenticated share, never put passwords directly in fstab. Create a credentials file instead:
sudo vi /root/.smbcredentials
Add the username and password:
username=smbuser1
password=your_samba_password
Lock down the file so only root can read it:
sudo chmod 600 /root/.smbcredentials
Now add the fstab entries:
sudo vi /etc/fstab
Append these lines (replace the IP with your Samba server’s address):
//192.168.1.130/public /mnt/samba-public cifs guest,uid=1000 0 0
//192.168.1.130/projects /mnt/samba-projects cifs credentials=/root/.smbcredentials,uid=1000 0 0
Test by unmounting and remounting through fstab:
sudo umount /mnt/samba-public /mnt/samba-projects
sudo mount -a
Verify the mounts came back:
df -hT | grep cifs
Both shares should reappear:
//192.168.1.130/public cifs 29G 2.4G 26G 9% /mnt/samba-public
//192.168.1.130/projects cifs 29G 2.4G 26G 9% /mnt/samba-projects
These mounts will now survive reboots.
Client Side: Access from Windows
On a Windows machine on the same network, open File Explorer and type the server address in the address bar:
\\192.168.1.130
You should see both public and projects shares listed. The public share opens without credentials. For the projects share, Windows will prompt for a username and password. Enter the Samba username (smbuser1) and the password you set with smbpasswd.
To map a share as a network drive: right-click This PC, select Map network drive, and enter \\192.168.1.130\projects as the folder path. Check “Connect using different credentials” and enter the Samba user credentials.
Client Side: Access from the Linux Mint File Manager
In Linux Mint’s Nemo file manager (or any GTK file manager like Nautilus), click File > Connect to Server or type directly in the address bar:
smb://192.168.1.130/public
For the authenticated share:
smb://192.168.1.130/projects
Nemo will prompt for the username, domain (use WORKGROUP), and password.
Server Side: Adding More Users
Back on the Samba server, add another user with access to the projects share:
sudo useradd -M -d /dev/null -s /usr/sbin/nologin -G sambashare smbuser2
sudo smbpasswd -a smbuser2
sudo smbpasswd -e smbuser2
No config changes or restarts needed. The valid users = @sambashare directive in the projects share automatically grants access to all members of the sambashare group.
Troubleshooting
NT_STATUS_ACCESS_DENIED when connecting
This means authentication failed. On the server, verify the user exists in Samba’s database:
sudo pdbedit -L
If the user is not listed, re-add them with sudo smbpasswd -a username. Also confirm the user is in the sambashare group: groups username.
Share not visible from Windows
On the server, check that nmbd is running (sudo systemctl status nmbd) and the firewall allows Samba (sudo ufw status). On the Windows client, verify the machine is on the same WORKGROUP. You can also try the direct path: type \\server-ip\sharename in File Explorer instead of browsing the network.
Permission denied when writing files
On the server, check that the Samba user is in the sambashare group and the directory has the correct group ownership:
ls -la /srv/samba/projects/
The directory should show drwxrws--- with group sambashare. The s in the group execute position is the setgid bit, which ensures new files inherit the group.
mount.cifs: iocharset utf8 not found
This error appears on the client when the nls_utf8 kernel module is missing (common on minimal server installations). Either load it with sudo modprobe nls_utf8, or remove the iocharset=utf8 option from your mount command and fstab entry. Modern Samba handles UTF-8 correctly without this option.
trying to follow this as new user and, well it’s near impossible.
you say to edit the smb.conf file. I enter the command you say but it won’t let me add or edit anything so how can I add the info if I can’t type anything?
have not bothered with the rest of the tut as if I can’t add to the smb.conf file I guess the rest is moot
would be nice if you had included HOW to add/edit the smb file for beginners.
Hi, we are sorry for that, we know it can be very frustrating to use vim, especially it you are a beginner. We apologise for that. In response to this, please check the guide again, we have updated in with explicit instructions, thank you.