How To Share Directories On Your Local Network From Ubuntu Desktop 22.04

Jack Wallen walks you through the simple steps of sharing a directory from Ubuntu Desktop 22.04 to your local network for other users to access.

Image: Mohamad Faizal/Adobe Stock

Ubuntu 22.04 (Jammy Jellyfish) is here, and it offers many exciting new features that are sure to appeal to die-hard Linux users as well as those new to the world of open source. As usual, the Ubuntu devs went out of their way to make everything not only work “right”, but do it easily.

SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)

Example: sharing directories on your local network. This is one area where Ubuntu has always been above the competition. In fact, you’d be hard-pressed to find a Linux distro that makes folder sharing as easy as Ubuntu.

And that’s exactly what I’m going to show you how to do… share a directory on your local network, so that other users can access the content in it.

What you will need

For this to work, you will need a running instance of Ubuntu Desktop 22.04 connected to a local area network (LAN). That’s it, let’s get to work.

How to share a directory on the local network using Ubuntu

Log in to your Ubuntu Desktop 22.04 instance, then open the File Manager application. Right-click the Public folder and select Local Network Share (Figure A).

Figure A

Sharing the public folder on your local network can be done through the right-click context menu in the File Manager application.
Sharing the public folder on your local network can be done through the right-click context menu in the File Manager application.

In the resulting popup window (Figure B), check the Share this folder box.

Figure B

Folder sharing options for the public folder.
Folder sharing options for the public folder.

Since Ubuntu Desktop 22.04 does not come with Samba pre-installed, you will be prompted to install Windows Network Sharing Service. Click Install Service (Figure C).

Figure C

Installing the sharing service is just one click away.
Installing the sharing service is just one click away.

When prompted, click Install again and, if prompted, enter your user password. Once the installation is complete, Samba will be running and you can continue to configure the share. Give the share a name, an optional comment, then set the permissions. If you want other users to be able to create and share files in the directory, check the box associated with this option. If you are the only user on this desktop computer, you will need to grant Guest access to the share.

After setting everything up, click Create Share and you’re done. Note: If you grant access to other users to create and share files, or grant access to guests, you will be prompted to allow the system to automatically set the permission (which you must allow).

Troubleshooting Sharing with Ubuntu

If you find that users cannot access the share, the problem is that the GUI tool is not able to add a Samba password for the system to use. This is one of those sticking points that has been troubling Ubuntu for some time. However, the solution to this problem is quite simple. All you have to do is open a terminal window and run the command:

sudo smbpasswd -a USER

Where USER is the name of the user account on your system.

What’s a bit annoying about this hiccup is that it just might be preventing guest access. For this reason, if you want to share the folder with someone, you will need to create a guest account. You can go back to the terminal window and add the user with the command:

sudo adduser guest

Answer the necessary questions (giving the guest user a strong password). Once you have created the user, you will then need to add them with the smbpasswd command as follows:

sudo smbpasswd -a guest

Follow this with the command:

sudo smbpasswd -e guest

At this point, you can give guest credentials to anyone who needs access to this public folder, and they should be able to access it from any machine on your local network.

If that doesn’t work, you’ll need to add the share to the Samba configuration file. Open this file with the command:

sudo nano /etc/samba/smb.conf

In this file, add the following at the bottom:

[Public]
path = /home/USER/Public
browsable = yes
writable = yes
read only = no

Where USER is your username. Save and close the file.

And if that doesn’t grant access to other registered users, you may need to add the guest account to the group associated with the share. For example, suppose the share is in /home/jack/Public (meaning it is owned by user/group jack. You can add the guest account to group jack with the command:

sudo usermod -aG jack guest

After that, any user belonging to the group jack should be able to access the public directory which has been shared on the local network.

I’d like to see in future releases of Ubuntu (or any Linux desktop release) a much more simplistic approach to successfully sharing directories on a local network without having to go through all the extra troubleshooting steps.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech tips for professionals from Jack Wallen.

Comments are closed.