Samba is a great way to share folders from your Linux desktop with other users on your network. For example, you might have documents that others need to access — or perhaps you have photos, video, or just about any type of file to share. Samba makes it possible to share those files and folders to any device on your network and do so with a required username and password.
I’ve already explained how Samba can be set up in this way. But this time around I want to demonstrate how you can create a share that doesn’t require a username or password for users to access, so you can make those files available to anyone connected to your network.
One thing to keep in mind is that you should never share files with sensitive information in this way. For those types of files you want to ensure your shares are set up for authentication; otherwise, that sensitive information could wind up in the wrong hands. In other words, use caution when doing this.
Before you jump into creating the guest folder, make sure to read through the piece linked above, so you can get Samba installed and understand how it works. In that piece, you create a password-protected share that can only be accessed by those who have accounts on the machine sharing the directory.
Once you’re familiar with Samba, it’s time to create the guess-accessible directory.
How to create your guest share with Samba
What you’ll need: To make this work, you’ll need a Linux machine running Samba and a user with sudo privileges. That’s it. Let’s get to work.
sudo nano /etc/samba/smb.conf
You should see a name for that interface, such as enp0s3.
The first thing you must change is this:
; interfaces = 127.0.0.0/8 eth0
Change that to:
interfaces = 127.0.0.0/8 NAME
Where NAME is the name of your network interface.
Next, locate the following line:
; bind interfaces only = yes
Change that to:
bind interfaces only = yes
[public] path = /home/share public = yes guest only = yes writable = yes force create mode = 0666 force directory mode = 0777 browseable = yes
The above configuration defines the path to the share; makes it public, guest only, and writable; sets the permission mode for file creation and directories; and makes it browsable.
Save and close the file with the Ctrl+X key combination.
sudo systemctl restart smbd
Once Samba has restarted, you should be able to access that share as a guest, without having to type a username or password.
This is a great way to allow any user on your network access to a specific directory. Just remember not to add sensitive files to that location; otherwise, they could wind up in the wrong hands.