Sharing folders from an Ubuntu PC to the network sounds like one of those jobs that should take three clicks and a celebratory sip of coffee. Sometimes it does. Sometimes Ubuntu, Samba, permissions, firewalls, and Windows decide to form a tiny committee and ask, “But are you really sure?”
The good news: once you understand the basic pieces, network folder sharing on Ubuntu is very manageable. Whether you want to move photos from your Ubuntu desktop to a Windows laptop, access project files from another Linux machine, or let a Mac grab media from your home office PC, Ubuntu can do the job smoothly using Samba, the standard file-sharing technology used for SMB network shares.
This guide explains how to share Ubuntu folders over a local network using both the graphical desktop method and the terminal method. It also covers permissions, firewall rules, connecting from Windows and macOS, and the practical troubleshooting steps that save you from staring at your router like it personally betrayed you.
What Does “Sharing a Folder on Ubuntu” Actually Mean?
When you share a folder from an Ubuntu PC to the network, you make that folder accessible to other devices connected to the same local network. Those devices may include Windows PCs, Macs, Linux laptops, media boxes, or even some file-manager apps on mobile devices.
For most homes and small offices, the most useful method is Samba. Samba lets Linux systems speak the SMB protocol, which is commonly used by Windows file sharing. That means your Ubuntu computer can appear like a normal network file server to Windows and macOS machines.
In plain English: Samba is the translator at the party. Ubuntu speaks Linux. Windows speaks SMB. Samba stands in the middle, smiles politely, and makes sure nobody spills the digital punch bowl.
Before You Start: What You Need
Before setting up Ubuntu network folder sharing, make sure you have a few basics ready:
- An Ubuntu PC connected to your local network.
- A folder you want to share, such as
Documents,Public, or a custom folder like/srv/samba/shared. - Another device on the same network, such as a Windows, Mac, or Linux computer.
- Administrator access on Ubuntu so you can install packages and adjust settings.
- A clear idea of whether the folder should be read-only, password-protected, or writable by other users.
For security, avoid sharing your entire home folder unless you have a very specific reason. A dedicated shared folder is cleaner, safer, and much easier to troubleshoot. Your future self will thank you, possibly with snacks.
Method 1: Share a Folder From Ubuntu Using the Desktop Interface
The easiest method for many Ubuntu Desktop users is to share a folder from the file manager. This approach is ideal if you want a quick home-network share without writing a custom Samba configuration by hand.
Step 1: Install Samba and the Sharing Plugin
On many Ubuntu systems, folder sharing may require Samba and the file-manager sharing extension. Open Terminal and run:
After installation, restart the file manager:
You may also need to log out and log back in if the sharing option does not appear right away. Computers enjoy testing patience. It is part of their charm.
Step 2: Choose the Folder You Want to Share
Open the Files app, right-click the folder you want to share, and look for an option such as Local Network Share or Sharing Options. The exact wording can vary slightly depending on your Ubuntu version and desktop environment.
Check the option to share the folder. You can usually choose whether other users may create and delete files in the folder. If you only want people to download or view files, leave write access disabled. If this is a family media folder or office drop box, write access may be useful.
Step 3: Set Guest or Password Access
Ubuntu may let you allow guest access, meaning other devices can open the folder without a username and password. Guest sharing is convenient, but it should only be used on a trusted private network. Do not use open guest shares on public Wi-Fi, school networks, hotels, cafes, or anywhere your laptop might become the unofficial neighborhood file buffet.
For better security, use password-protected access. Samba users are usually tied to existing Linux users, but Samba has its own password database. To add your Ubuntu user to Samba, run:
Replace yourusername with your actual Ubuntu username. You will be asked to create a Samba password. It can match your Ubuntu login password, but for better security, a different strong password is often smarter.
Method 2: Share a Folder From Ubuntu Using Terminal
If you want more control, the terminal method is the reliable, professional way to share folders from an Ubuntu PC to the network. This is especially useful for a home server, small office file share, media library, or a computer that other people will access regularly.
Step 1: Install Samba
Open Terminal and run:
Check that Samba installed successfully:
Step 2: Create a Dedicated Shared Folder
A good location for shared data is under /srv/samba. Create a folder named shared:
Set ownership to your user:
Set reasonable permissions:
If other users need write access, use a shared Linux group rather than giving everyone full access. The famous chmod 777 approach is tempting because it works quickly, but it is the networking equivalent of removing your front door because keys are annoying.
Step 3: Back Up the Samba Configuration
Before editing Samba’s configuration file, make a backup:
Now open the configuration file:
Scroll to the bottom and add a share definition like this:
Replace yourusername with your Ubuntu username. This configuration creates a share named Shared, points it to /srv/samba/shared, allows browsing, enables writing, disables guest access, and limits access to your Samba user.
Step 4: Create or Enable the Samba Password
Add your user to Samba with:
Enable the user if needed:
Step 5: Test and Restart Samba
Check your configuration for errors:
If everything looks good, restart Samba:
You can also check the service status:
At this point, your Ubuntu folder should be shared on the network.
Allow Samba Through the Ubuntu Firewall
If Ubuntu’s firewall is enabled, other devices may not see or access your shared folder until Samba is allowed through. Check the firewall status:
To allow Samba, run:
For a more secure setup, restrict Samba access to your local network range. For example, if your home network uses 192.168.1.x, you can use:
This is better than opening file sharing broadly. Samba is meant for trusted local networks, not for casually exposing your documents to the entire internet like a garage sale with tax records.
Find Your Ubuntu PC’s Network Address
Other devices need to know where your Ubuntu computer lives on the network. To find the IP address, run:
You may see something like:
You can also find your computer name with:
If local name resolution is working, other devices may be able to connect using the hostname instead of the IP address. For example:
However, IP addresses are often more reliable when testing. Once everything works, you can get fancy with hostnames, bookmarks, and mapped drives.
How to Access the Ubuntu Shared Folder From Windows
On a Windows 10 or Windows 11 computer, open File Explorer and type the Ubuntu share path into the address bar:
Replace 192.168.1.45 with your Ubuntu PC’s IP address. If prompted, enter your Samba username and password.
To make the folder easier to access later, right-click This PC, choose Map network drive, select a drive letter, and enter the same network path. After that, your Ubuntu folder can appear almost like a normal drive in Windows.
How to Access the Ubuntu Shared Folder From macOS
On a Mac, open Finder and choose Go > Connect to Server. Enter the SMB address:
Click Connect, choose registered user if needed, and enter the Samba username and password. The share should mount in Finder, where you can browse, copy, and manage files depending on the permissions you configured.
How to Access the Ubuntu Shared Folder From Another Linux PC
On another Ubuntu or Linux desktop, open the file manager and look for Other Locations or Network. You can usually enter:
For command-line access, install Samba client tools:
Then list shares:
This is a useful way to confirm that Samba is visible before blaming Windows, macOS, the router, the moon phase, or all four.
Best Permission Settings for Ubuntu Folder Sharing
Permissions are where many Samba problems begin. Remember that Samba access has two layers: Samba permissions and Linux filesystem permissions. Both must allow the action. If Samba says “yes” but Linux says “absolutely not,” the file operation fails.
For Read-Only Sharing
Use a configuration like:
This is good for media libraries, installers, reference documents, and folders where you do not want accidental edits.
For Writable Private Sharing
Use:
Make sure the Linux folder is owned by that user or by a group the user belongs to.
For Shared Team Folders
Create a group, add users to it, and configure group permissions. For example:
The 2 in 2775 helps new files inherit the folder’s group, which is handy for collaboration.
Common Problems and How to Fix Them
Problem: Windows Cannot Find the Ubuntu Share
First, try connecting by IP address instead of computer name:
If that works, the problem is likely name discovery, not Samba itself. You can continue using the IP address or configure local hostname resolution later.
Problem: Permission Denied
Check both Samba and Linux permissions. Confirm that the user exists in Samba:
Check folder ownership:
If the wrong user owns the folder, correct it:
Problem: The Share Appears but Files Cannot Be Created
Make sure the Samba share is not read-only:
Also make sure the Linux filesystem allows writing. Samba cannot magically write to a folder Linux has locked down. Samba is useful, not a wizard. Although, on a good day, it gets close.
Problem: Firewall Blocks the Share
Run:
If UFW is active, allow Samba:
Then restart Samba and test again:
Security Tips for Sharing Ubuntu Folders
Network sharing is convenient, but convenience should not mean “free snacks for intruders.” Follow these practical security habits:
- Share only the folders you need, not your whole system.
- Use password-protected shares for anything personal or important.
- Keep guest access disabled unless the network is fully trusted.
- Restrict firewall access to your local subnet when possible.
- Use strong Samba passwords.
- Back up important shared folders regularly.
- Do not expose Samba directly to the public internet.
If you need remote file access while away from home, use a VPN or a secure cloud-sync solution instead of opening SMB ports on your router. Opening Samba to the internet is like mailing your house key to “Current Resident, Planet Earth.”
Practical Example: A Home Media Share
Imagine you want to share a folder named Media from your Ubuntu PC so your Windows laptop and Mac can access movies, music, and family videos on your home network.
Create the folder:
Edit Samba:
Add:
Add the Samba password:
Restart Samba:
Allow the firewall:
Now connect from Windows with:
Or from macOS with:
This setup is simple, practical, and easy to expand later.
Experience Notes: What Actually Matters When Sharing Ubuntu Folders
After setting up Ubuntu folder sharing more than a few times, the biggest lesson is this: do not rush the permissions. Most sharing problems are not caused by Samba being broken. They are caused by Samba permissions, Linux permissions, and firewall settings politely disagreeing with each other in three different languages.
The cleanest experience usually comes from creating a dedicated folder under /srv/samba instead of sharing random folders from your home directory. It keeps things organized and avoids hidden permission surprises. Home folders can have extra restrictions, and desktop folders may behave differently depending on how the system is configured. A dedicated shared folder is boring, and in networking, boring is beautiful.
Another practical tip is to test in layers. First, confirm Samba is running. Then check the configuration with testparm. Then test locally with smbclient. Then test from another device using the IP address. Only after that should you worry about pretty hostnames and network browsing. This approach turns one big mystery into several small, manageable checks.
For home users, mapping the Ubuntu share as a network drive in Windows is worth the extra minute. Once mapped, the share feels much more natural. You can save files directly to it, drag folders into it, and use it in many apps without typing the network path every time. On macOS, adding the SMB share to Finder favorites gives a similar benefit.
It is also smart to create shares based on purpose. A Media share can be read-only for most people. A Transfer share can allow writing so family members or coworkers can drop files into it. A Private share can be limited to one user. Separating folders this way makes permissions easier to understand and reduces the chance of someone deleting important files while trying to upload vacation photos.
One mistake beginners often make is enabling guest write access because it seems convenient. It is convenient, but it can also become messy quickly. Files may be created with unexpected ownership, anyone on the network may be able to change content, and troubleshooting becomes harder. Password-protected sharing is only slightly more work and usually much safer.
Finally, remember that network sharing is not a backup. A shared folder makes files easier to access, but it does not protect them from deletion, disk failure, ransomware, or “oops, I dragged the wrong folder.” If the shared folder matters, back it up to an external drive, another computer, or a reliable backup service. Samba helps your devices talk to each other; it does not save you from human creativity.
Conclusion
Learning how to share folders from an Ubuntu PC to the network is one of those practical Linux skills that pays off quickly. With Samba, Ubuntu can share files with Windows, macOS, and other Linux machines using a familiar SMB network share. For simple needs, the desktop sharing option may be enough. For a stable home or office setup, editing Samba directly gives you better control over users, paths, permissions, and security.
The best setup is usually simple: create a dedicated folder, install Samba, add a password-protected user, configure the share, allow Samba through the firewall, and connect from other devices using the Ubuntu PC’s IP address. Once it works, you can map the drive, bookmark it, and enjoy the quiet satisfaction of files moving across the network without a USB stick doing the walk of shame from desk to desk.
Note: This article is written for local network sharing on trusted home or office networks. For remote access over the internet, use a secure VPN or another protected remote-access method instead of exposing Samba directly online.