How to Share Folders from an Ubuntu PC on Your Network

You can share a folder from an Ubuntu PC with Windows, Linux, and other SMB-capable devices by running Samba. A reliable current method is to create a share in /etc/samba/smb.conf, give a Samba password to an existing Ubuntu user, and connect to the share by hostname or IP address. The steps below use an authenticated share rather than open guest access.

Canonical’s current Samba file-server guide uses the same Samba package and configuration file. These steps apply to supported Ubuntu releases, including 24.04 LTS and 26.04 LTS.

How to share a folder from Ubuntu over the network

1. Install Samba

Open Terminal and install the Samba server package:

sudo apt update
sudo apt install samba

Samba provides the SMB file-sharing service used by Windows and other desktop operating systems.

Ubuntu Terminal installing the Samba package with apt
Install Samba from Ubuntu’s package repositories.

2. Create the folder you want to share

This example keeps shared data under /srv, which Canonical recommends for data served by the system. Create the directory and make your current Ubuntu account its owner:

sudo mkdir -p /srv/samba/share
sudo chown -R "$USER":"$USER" /srv/samba/share
chmod 0770 /srv/samba/share

You can use another folder instead, but its Linux permissions must allow the Samba user to read or write it.

Ubuntu Terminal creating the /srv/samba/share directory
Create a dedicated directory for the network share.

3. Add the share to smb.conf

Back up the configuration, then open it in a text editor:

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo nano /etc/samba/smb.conf

Add this block at the end. Replace yourusername with your actual Ubuntu username:

[Shared]
    path = /srv/samba/share
    browseable = yes
    read only = no
    guest ok = no
    valid users = yourusername
    create mask = 0660
    directory mask = 0770

read only = no allows writes, while guest ok = no requires credentials. The valid users line limits this share to the account you specify.

Ubuntu text editor showing the Shared Samba configuration block
Add a share block to /etc/samba/smb.conf and keep guest access disabled for the authenticated setup.

4. Create a Samba password

Samba keeps its own credentials database. Your Linux account must already exist before it can be added to Samba. Run:

sudo smbpasswd -a "$USER"

Enter the password you want network clients to use. Canonical’s share access-control documentation and the Samba smbpasswd manual both describe this separate authentication step.

Ubuntu Terminal creating a Samba password for a local user
Add your existing Linux account to Samba’s separate credentials database.

5. Check the configuration and restart Samba

Before restarting the service, check the configuration for syntax problems:

sudo testparm

If the configuration loads successfully, restart the SMB service:

sudo systemctl restart smbd
sudo systemctl status smbd --no-pager

If smbd is active, the share is ready to accept connections.

Ubuntu Terminal validating smb.conf with testparm and restarting smbd
Validate the configuration before restarting the Samba service.

6. Allow Samba through UFW if the firewall is active

First check UFW:

sudo ufw status

If it is active, allow the Samba application profile. For better LAN-only exposure, replace the example subnet with your own:

sudo ufw allow from 192.168.1.0/24 to any app Samba

Ubuntu’s firewall documentation documents both the Samba application profile and subnet-restricted syntax.

Ubuntu Terminal allowing the Samba UFW application profile from a local subnet
If UFW is active, allow Samba only from your local subnet when possible.

7. Connect from Windows

Find the Ubuntu PC’s address with hostname -I. In Windows File Explorer, enter a path such as:

\\192.168.1.10\Shared

Sign in with the Ubuntu username you placed in valid users and the Samba password from step 4. Use your real Ubuntu IP address, not the example above.

Windows 11 File Explorer opening an Ubuntu Samba share by IP address
Windows can open the share directly with the Ubuntu PC’s IP address and share name.

8. Connect from another Ubuntu or Linux PC

In GNOME Files, press Ctrl+L or use Other Locations, then enter:

smb://192.168.1.10/Shared

Other SMB clients can use the same server address, share name, username, and password. macOS Finder can also use an smb:// server address through Go > Connect to Server.

Ubuntu Files opening the same Samba share with an smb:// address
Linux desktops using GNOME Files can connect with an smb:// address.

If the Ubuntu share does not appear under Network

Do not assume the share is broken just because it is not automatically listed. On fresh Ubuntu 26.04 LTS installs, Samba’s NetBIOS support is disabled by default, according to Canonical’s 26.04 LTS release notes. Directly opening \\IP-address\Shared or smb://IP-address/Shared is usually the fastest test.

  • Access denied: confirm the username matches valid users and that the Linux account can access the shared directory.
  • Connection refused: run systemctl status smbd and verify UFW is not blocking Samba.
  • Configuration error: run sudo testparm again and fix the reported line in smb.conf.
  • IP address changed: check hostname -I again or configure a DHCP reservation on your router.

What about the “Local Network Share” option in Files?

Ubuntu still publishes the nautilus-share package, which adds Samba sharing integration to GNOME Files, but it is not guaranteed to be installed by default and the menu flow can vary by Ubuntu release. Manual Samba configuration is more technical, but it makes authentication, permissions, firewall rules, and troubleshooting explicit.

Should you enable guest access?

Guest sharing is convenient on a trusted home network, but it lets clients connect without a Samba password. Canonical’s file-server guide includes a guest-share example, yet its own warning notes that this grants broad access on the local network. For personal documents or any network you do not fully trust, keep guest ok = no and use authenticated users instead.

Leave a Comment

How to Record Speaker Output on Linux with Audacity

How to Record Speaker Output on Linux with Audacity

Capture Linux desktop audio in Audacity by routing its recording stream to your output device’s monitor source. Follow PulseAudio and PipeWire steps, export tips, and fixes for silent tracks.

How to Use Dropbox on Linux: Install and Sync Your Files

How to Use Dropbox on Linux: Install and Sync Your Files

Install Dropbox on Linux from the official package, sign in, sync a local folder, manage selective sync, and check status from the command line.

How to Install Inkscape on Linux: Ubuntu, Fedora, Arch, and More

How to Install Inkscape on Linux: Ubuntu, Fedora, Arch, and More

Install Inkscape from your Linux distribution’s repositories, the Ubuntu stable PPA, Snap, or Flathub, with current commands and notes for choosing a package source.

How to Find and Remove Duplicate Files on Linux With FSlint

How to Find and Remove Duplicate Files on Linux With FSlint

Use FSlint to scan selected Linux folders, review duplicate groups, and safely delete redundant files or learn when hard-link merging is appropriate.

How to Install SABnzbd on Linux and Configure It

How to Install SABnzbd on Linux and Configure It

Install SABnzbd on Ubuntu or Debian, or run it in Docker on another Linux host. Then open the web interface and configure your provider and download folders.

How to Install the Paper GTK Theme on Linux

How to Install the Paper GTK Theme on Linux

Install the Paper GTK theme from supported Linux repositories, enable it for GTK apps in GNOME Tweaks, and see what the legacy theme can and cannot change.

How to Install and Set Up Plex on OpenMediaVault with Compose

How to Install and Set Up Plex on OpenMediaVault with Compose

The old OpenMediaVault Plex plugin is archived. Set up Plex on OMV 8 with OMV-Extras, the Compose plugin, persistent storage, and Plex’s official container.

How to Clean and Speed Up Ubuntu Safely

How to Clean and Speed Up Ubuntu Safely

Clean and speed up Ubuntu with safe APT cleanup, storage checks, and startup controls that help free space and troubleshoot a sluggish desktop.

How to Install the Hiri Email Client on Linux

How to Install the Hiri Email Client on Linux

Install Hiri on Linux with its Snap package or official tarball, add a desktop launcher, and check supported accounts plus a warning about Hiri’s old Snap release.

How to Get System Specifications for a Linux PC

How to Get System Specifications for a Linux PC

Use Fastfetch and built-in Linux commands to check your distro, kernel, CPU, memory, graphics, storage, and connected devices, then save a clear report.