Operations 4 min read

How to Set Up a Samba File Share on Ubuntu 16.04 – Step‑by‑Step Guide

Learn how to install and configure Samba on Ubuntu 16.04, create a shared directory, set up a Samba user, edit the smb.conf file, restart the service, and map the share from Windows, with full command‑line examples and screenshots.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Set Up a Samba File Share on Ubuntu 16.04 – Step‑by‑Step Guide

What Is Samba?

Samba allows a Linux system to share directories that can be accessed directly from Windows machines.

Installing Samba on Ubuntu 16.04

sudo apt-get install samba samba-common

After installation, a screenshot of the terminal output is shown.

Creating the Shared Directory on Ubuntu

1. Make a directory and set permissions

peng@ubuntu:~$ mkdir work
peng@ubuntu:~$ sudo chmod 777 work
peng@ubuntu:~$ cd work/
peng@ubuntu:~/work$ pwd
/home/peng/work

2. Create a Samba user

sudo smbpasswd -a yikou

The user yikou is created with password 1. If the command fails with Failed to add entry for user phinecos, add the corresponding system account:

sudo groupadd yikou -g 6000
sudo useradd yikou -u 6000 -g 6000 -s /sbin/nologin -d /dev/null

3. Edit the Samba configuration

sudo vim /etc/samba/smb.conf

Append the following section to the end of the file:

[yikou]
    path = /home/peng/work    # shared folder path
    available = yes
    browseable = yes
    writable = yes

4. Restart the Samba service

/etc/init.d/smbd restart

Mapping the Share on Windows

Ensure the Windows machine can reach the Ubuntu host (e.g., ping the Ubuntu IP address). ping 192.168.0.115 Open Computer → Map network drive and enter the share path: \\192.168.0.115\yikou When prompted, use the Samba username yikou and password 1. After confirming, the network drive (e.g., Z:) appears, showing the same contents as the Ubuntu shared directory.

The Ubuntu Samba server root directory now mirrors the Windows mapped drive.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

WindowsUbuntufile sharingSamba
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.