I regularly share files and folders across my home network from Linux. In fact, I have one machine that houses a particular folder that is home to all of my first-draft manuscripts. When I decided I'd rather keep those files in-house (instead of risking a third-party cloud provider using them to train AI neural networks), Samba was the obvious solution.
Also: Linux kernel 6.8 offers some exciting new features and 'fixes all over'
For someone who has used Linux for decades, setting up a Samba share was a no-brainer. For those who are new to the open-source operating system, it's not quite as simple. Thankfully, two of the most popular Linux GUIs (GNOME and KDE Plasma) make it a bit easier to create such shares.
I want to walk you through the process of doing just that, so you can create network shares on your Linux machine with ease.
What you'll need: To make this work, you'll need a Linux distribution with either the GNOME or KDE Plasma desktop environments. You'll also need a user with sudo privileges. That's it. Let's make it happen. I'll demonstrate on a Ubuntu-based distribution (Pop!_OS). If you use a Fedora-based distribution, make sure to swap out apt-get for the dnf package manager during the Samba installation process.
In case your Linux distribution didn't ship with Samba pre-installed, you can install it with the command:
sudo apt-get install samba -y
If your distribution is Fedora-based, that command would be:
sudo dnf install samba -y
By default, users need to be added and enabled for Samba usage. This only requires two commands. The first adds the user to Samba with this command (where USERNAME is your Linux username):
sudo smbpasswd -a USERNAME
You'll first be prompted for your sudo password and required to type and verify a password for Samba.
Also: BigLinux makes Linux easy for anyone - and it should be way more popular
Next, enable the user with the command (where USERNAME is your Linux username):
sudo smbpasswd -e USERNAME
To make this work with the Natilus file manager (aka "Files"), you need to install a piece of software with the command:
sudo apt-get install nautilus-share -y
If your distribution usesdnf, that command is:
sudo dnf install nautilus-share -y
You can restart Nautilus with the command:
nautilus -q
Open Nautilus and locate the folder you want to share. Right-click that folder and select Local Network Share.
If you don't see this menu entry, you might want to log out and log back in.
Screenshot by Jack WallenIn the resulting pop-up window, click the checkbox for Share this folder. Once you've done that, you can name the share, and then (if you want to give permission for users to alter the contents of the share) click the checkbox for "Allow others to create and delete files in this folder." If you want to allow anonymous logins to be able to access the share, you can click the checkbox for Guest access (although I wouldn't recommend that for security reasons).
Once you've taken care of the commands, this is all you need to do to share a folder in GNOME.
Screenshot by Jack WallenClick Create Share and then, when prompted, click Add the permissions automatically. If you receive an error that includes "net usershare' returned error 255," you'll need to run the following two commands:
sudo mkdir -p /var/lib/samba/usershares/sudo chmod go+rwx /var/lib/samba/usershares/
Once you've done that, you should be able to access the shared folder from your network.
Log into KDE Plasma and open the Konsole app. Issue the command:
sudo apt-get install kdenetwork-filesharing -y
If your distribution is based on Fedora, that command would be:
sudo dnf install kdenetwork-filesharing -y
Also: The top cloud storage services you can buy to protect your files
You'll then need to go through the same process outlined above for adding and enabling your users for Samba shares.
Right-click on the folder you want to share and click Properties. In the resulting pop-up, click on the Share tab.
At the top of the Share tab, you'll probably see a warning with a button marked Fix Permissions. Click that button. When prompted, click Change Permissions.
You will most likely see this error.
Screenshot by Jack WallenBack at the Share tab, click the checkbox for "Share this folder with other computers on the local network." Once you've done that, you can then configure the share by giving it a name and allowing/configuring guest access. I would suggest leaving Everyone with Read Only permissions and giving your user Full Control. Once you've done that, click OK.
You can now configure the share exactly how you want/need.
Screenshot by Jack WallenAlso: The first 5 Linux commands every new user should learn
Once you've done these steps, you can share any folder (so long as you have permission to access it) from your Linux machine to your network.