If you have multiple computers on your network and want to be able to share files and folders from your Linux operating system, the process is not as difficult as you think. And while some Linux distributions seek to make this a point-and-click affair, they tend to miss the mark.

Then you need to go to Samba and the terminal window. But do not be afraid, I will show you how to do it in simple words. Once done, everyone on your LAN should have access to these shared folders and files.

ZDNet recommends

The best classes on Linux Foundation

The best classes on Linux Foundation

Do you want good technological work? Then you need to know Linux and open source software. One of the best ways to learn is through a Linux Foundation course.

For this to work, you will need a working instance of Linux and a user with sudo privileges. I will demonstrate the process with the easy-to-use Ubuntu Desktop 22.04, but the process will be the same for most distributions (the only exception is installing Samba).

With that said, let’s move on to sharing.

Installing Samba

The first thing we need to do is install Samba. We will do this from the command line, so log in to your Linux desktop and open the application in the terminal window. With the terminal open, install Samba with:

sudo apt-get install samba -y

If you are on a Fedora-based (or RHEL-based) desktop, this installation will be:

sudo dnf install samba -y

You may find that Samba is already installed by default. Either way, you are ready to move on.

Start and activate the Samba service with:

sudo systemctl enable --now smbd

Some Linux file managers allow you to share folders directly from the GUI application. I will share the manual process with you in case your file manager does not include this option.

Create a partition

Assume that the folder you want to share is the public folder in your home directory (so / home / USER / Public – where USER is your username). Back in the terminal window we will open the Samba configuration file with the command:

sudo nano /etc/samba.smb.conf

At the bottom of this file, place the following:

[Public]
path = /home/USER/Public
browsable = yes
writable = yes
read only = no
force create mode = 0666
force directory mode = 0777

Where USER is your username.

Note: If you do not want other users to be able to make changes to files and folders, set the option to save to no.

Save and close the file. Restart Samba with:

sudo systemctl restart smbd

At this point, your Samba sharing will be visible on the web, but will not allow anyone to access it. Let’s fix this.

I assume you are the only user of your Linux machine. However, you do not want to share your login credentials with other users, and you do not want to allow anonymous access to the shared directory (as this may be a security issue). So what to do? Let’s create a new account on your machine that can be used by others to access files and folders.

In the terminal window, create a user named Guestshare with the command:

sudo adduser guestshare

Give this user a unique and strong password, call him Samba Guest (or something similar) and then just press Enter on your keyboard for other questions.

Then we need to activate this user for Samba, so run the following two commands:

sudo smbpasswd -a guestshare
sudo smbpasswd -e guestshare

The first command above adds the user, and the second command activates the user.

After entering the first command, you will be prompted to add a new password for Samba. You can use the same password you added when you created your guest sharing account.

Every user on your network should now have access to this folder using guest sharing credentials.

And that’s all you need to create a shared Linux folder from your custom home directory. Not only can users see the files and folders in them, but they can also create and modify them.

https://www.zdnet.com/article/how-to-share-folders-to-your-network-from-linux/#ftag=RSSbaffb68

Previous articleAvatar: The blockbuster movie that history has forgotten
Next articleHow to get GitHub Slack integration?